Modify

Opened 13 months ago

Last modified 7 months ago

#3760 assigned Bug

Number() bug with oversized integer values

Reported by: jchd18 Owned by: Jpm
Milestone: 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 (4)

comment:1 Changed 9 months ago by Jpm

  • Owner set to Jpm
  • Status changed from new to assigned

Hi, Fis send to Jon

comment:2 follow-ups: Changed 7 months ago by anonymous

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

this not work, return 0 only

comment:3 in reply to: ↑ 2 Changed 7 months ago by jchd18

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.

comment:4 in reply to: ↑ 2 Changed 7 months ago by Jpm

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

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 assigned The owner will remain Jpm.
Author


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

 
Note: See TracTickets for help on using tickets.