-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC 80] toDate
can overflow
#85
Comments
I think the answer to this is that we bound |
To retain analyzability, it is important for every long (64-bit integer) to represent a legal If we don't do that, we are effectively introducing a subtype of integers ("those that represent legal dates / durations"), and this form of subtyping is not something we can express in the encoding. So, let's allow all valid 64-bit values as durations, and throw overflow errors when calculations overflow. |
Unless I'm mistaken, you can write something like |
Stacking I guess expanding the definition of what consitutes overflow to another 292 million years is fine, though. :) |
IIUC, what @emina suggests is that there should not be any restrictions on the |
@shaobo-he-aws: correct. I was responding to the objection that the By officially supporting this range, we'll be able to market Cedar to new applications -- paleontology (at least up to the Mesozoic era, or so). |
In RFC 80 (i.e., the
datetime
extension),toDate
is proposed as a method ofdatetime
. If its meaning is that it should return the date where the instant is, then it could overflow. A counterexample isdatetime("1970-01-01").offset(duration("-9223372036854775808ms")).toDate()
, which should return the date106751991168 (9223372036854775808/86400000 + 1)
days before the Unix epoch, and this date cannot be represented by along
.The text was updated successfully, but these errors were encountered: