-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
consistency⚠️ Breaking changeIssues whose solution requires a back-incompatible change to the public APIIssues whose solution requires a back-incompatible change to the public API
Description
I think this is not desirable:
seq(as.integer64(1), 10, by=1.5)
# integer64
# [1] 1 2 3 4 5 6 7 8 9 10
seq(1, 10, by=1.5)
# [1] 1.0 2.5 4.0 5.5 7.0 8.5 10.0The trouble is that we can't always embed into double from integer64:
seq(as.integer64(2^60), by=1L, length.out=10L)
# integer64
# [1] 1152921504606846976 1152921504606846977 1152921504606846978
# [4] 1152921504606846979 1152921504606846980 1152921504606846981
# [7] 1152921504606846982 1152921504606846983 1152921504606846984
# [10] 1152921504606846985
sprintf("%18.f", seq(2^60, by=1L, length.out=10L))
# [1] "1152921504606846976" "1152921504606846976" "1152921504606846976"
# [4] "1152921504606846976" "1152921504606846976" "1152921504606846976"
# [7] "1152921504606846976" "1152921504606846976" "1152921504606846976"
# [10] "1152921504606846976"That said, the seq() output is entirely determined by from, to, and by; we can cheaply examine these up front and determine if the output sequence embeds entirely in (1) integer64; (2) double; (3) neither.
Then we should determine the output as follows:
- Return integer64
- Return double
- Warn, and return integer64
Metadata
Metadata
Assignees
Labels
consistency⚠️ Breaking changeIssues whose solution requires a back-incompatible change to the public APIIssues whose solution requires a back-incompatible change to the public API