Opened 11 years ago
Closed 6 years ago
#3017 closed Bug (Duplicate)
The largest negative integer value we misinterpret
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.3.13.20 | Severity: | None |
| Keywords: | integer | Cc: |
Description
The following code illustrates the problem
ConsoleWrite("- 9223372036854775808 = (int)" & Int (-9223372036854775808) & "= (hex)" & Hex (-9223372036854775808) &CRLF)
ConsoleWrite("- 9223372036854775807-1 = (int)" & Int (-9223372036854775807 - 1) & "= (hex)" & Hex (-9223372036854775807 - 1) &CRLF)
at -9223372036854775808 I get as a result -9223372036854775807
at (-9223372036854775807 - 1) I get the correct result -9223372036854775808
tested with the last stable and beta version
Attachments (0)
Change History (7)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
That's not an Int64 value, it's too large. When converting it to a 64 bit value, -9223372036854775808 and -9223372036854775807 yield the same result.
http://www.binaryconvert.com/result_double.html?decimal=045057050050051051055050048051054056053052055055053056048056
comment:3 by , 11 years ago
Not Int with Double confused !!
http://calc.penjee.com/?s=HJJJJJJJJJJJJJJJ
comment:4 by , 11 years ago
-9223372036854775808 and -9223372036854775807 yield the same result.
Only when using a site which limits integral values to Int32 or under the double tab.
And no they are not the same value and both are valid int64 values.
comment:5 by , 11 years ago
This appears to be a bug connected with string conversion. See the following topic : https://www.autoitscript.com/forum/topic/176690-number-puzzle/ It seems to occur with various functions which convert the integer to a string - including ConsoleWrite.
ConsoleWrite(-9223372036854775808 & @LF) ; -9223372036854775807
comment:6 by , 11 years ago
| Summary: | The smallest value of integer we misinterpreted → The largest negative integer value we misinterpret |
|---|

This is rather the largest negative int64 value, but yes there seems to be an issue with parsing the literal value -9223372036854775808.