Opened 3 months ago

#3760 new Bug

Number() bug with oversized integer values

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


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

MinInt64 = -9223372036854775808
MaxInt64 = 9223372036854775807


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")
	Return Number($s)

Attachments (0)

Change History (0)

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

as new The ticket will remain with no owner.

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

Note: See TracTickets for help on using tickets.