Modify

Opened 6 years ago

Closed 4 years ago

#3760 closed Bug (Fixed)

Number() bug with oversized integer values

Reported by: jchd18 Owned by: Jon
Milestone: 3.3.15.5 Component: AutoIt
Version: 3.3.14.5 Severity: None
Keywords: Cc:

Description

Number($s) erroneously converts values outside [MinInt64, MaxInt64] to MinInt64 or MaxInt64.

MinInt64 = -9223372036854775808
MaxInt64 = 9223372036854775807

Example:

Number("22222222222222222222222222222222")  ; returns 9223372036854775807

Workaround version returning a FP values in such case:

Func _Number($s)
	Local $a = StringRegExp($s, "^([-+]?)0*(\d+)$", 1)
	If Not @error Then
		Local $l = StringLen($a[1])
		; in case the int is oversized
		If $l > 19 Or ($a[0] <> "-" And $a[1] > "9223372036854775807") Or ($a[0] = "-" And $a[1] > "9223372036854775808") Then Return Number($s & ".0")
	EndIf
	Return Number($s)
EndFunc

Attachments (0)

Change History (5)

comment:1 by J-Paul Mesnage, 6 years ago

Owner: set to J-Paul Mesnage
Status: newassigned

Hi, Fis send to Jon

comment:2 by anonymous, 5 years ago

Local $dNumber6 = Number("24autoit") ; Returns 24

this not work, return 0 only

in reply to:  2 comment:3 by jchd18, 5 years ago

Local $dNumber6 = Number("24autoit") ; Returns 24

this not work, return 0 only

Untrue. The code correctly sets $dNumber6 to 24.
Please use the help forum instead.

in reply to:  2 comment:4 by J-Paul Mesnage, 5 years ago

Replying to anonymous:

Local $dNumber6 = Number("24autoit") ; Returns 24

this not work, return 0 only

please don't use an open ticket for something else this ticket is with oversized number

comment:5 by Jon, 4 years ago

Milestone: 3.3.15.5
Owner: changed from J-Paul Mesnage to Jon
Resolution: Fixed
Status: assignedclosed

Fixed by revision [12635] in version: 3.3.15.5

Modify Ticket

Action
as closed The owner will remain Jon.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.