Modify

Opened 4 years ago

Last modified 4 years ago

#3017 new Bug

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 (6)

comment:1 Changed 4 years ago by jchd18

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

comment:2 Changed 4 years ago by BrewManNH

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 Changed 4 years ago by anonymous

Not Int with Double confused !!
http://calc.penjee.com/?s=HJJJJJJJJJJJJJJJ

comment:4 Changed 4 years ago by jchd18

-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 Changed 4 years ago by czardas

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 Changed 4 years ago by jchd18

  • Summary changed from The smallest value of integer we misinterpreted to The largest negative integer value we misinterpret

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.