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
(1073741824 = -1073741824) is true ! #3582
Comments
Comment author: administrator See #3302. Obvious fix causes problems with the way integer literals are |
Comment author: @damiendoligez As of 4.00.1, the behaviour is still there, and it's unlikely to ever be changed. |
Comment author: @mshinwell I checked this and the answer is now false. |
Comment author: @mshinwell Actually, no, this isn't entirely fixed: 1073741824 is still accepted as a literal, even if the comparison given by the original author of this issue now does give the right answer. |
Comment author: @xavierleroy @shinwell: you're testing on a 64-bit machine while the original example is for a 32-bit machine, so you're just missing the issue. It is still the case that the decimal integer literal corresponding to max_int+1 parses without error and results in min_int. |
Comment author: @damiendoligez In order to test on 64-bit machines, you need to compare 4611686018427387904 and -4611686018427387904. |
Original bug ID: 3582
Reporter: administrator
Status: resolved (set by @damiendoligez on 2016-12-07T15:13:36Z)
Resolution: won't fix
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Related to: #3302 #4210
Monitored by: dsheets
Bug description
Full_Name: Thomas de Grivel
Version: 3.08.2
OS: debian
Submission from: robinson-2-82-67-155-88.fbx.proxad.net (82.67.155.88)
The integer literal 1073741824 is accepted even if it is outside the range of
representable integers.
In the ocaml 3.08.2 toplevel:
1073741824;;
1073741824 = -1073741824;;
It really should fail just like it's successor :
1073741825;;
Integer literal exceeds the range of representable integers of type int
The text was updated successfully, but these errors were encountered: