Modify

Opened 5 years ago

Closed 3 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 Changed 4 years ago by Jpm

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

Hi, Fis send to Jon

comment:2 follow-ups: Changed 4 years ago by anonymous

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

this not work, return 0 only

comment:3 in reply to: ↑ 2 Changed 4 years 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 4 years 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

comment:5 Changed 3 years ago by Jon

  • Milestone set to 3.3.15.5
  • Owner changed from Jpm to Jon
  • Resolution set to Fixed
  • Status changed from assigned to closed

Fixed by revision [12635] in version: 3.3.15.5

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 closed The owner will remain Jon.
Author


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

 
Note: See TracTickets for help on using tickets.