Opened 9 years ago
Closed 4 years ago
#3179 closed Bug (Fixed)
Number failure with lower case hex
Reported by: | czardas | Owned by: | Jon |
---|---|---|---|
Milestone: | 3.3.15.4 | Component: | AutoIt |
Version: | 3.3.14.2 | Severity: | None |
Keywords: | Number Hexadecimal | Cc: |
Description
The interpreter is not fussy when it comes to lower case hexadecimal strings representing integers. The Number function seems to disregard this fact. Either this is a bug or it represents an inconsistency, which seems undesirable from my perspective.
ConsoleWrite('Execute()' & @LF) ; Integers are not case sensitive in AutoIt ConsoleWrite(Execute('0x07AFBFEF4FF55FF0') & @LF) ; Uppercase [success] ConsoleWrite(Execute('0x07afbfef4ff55ff0') & @LF) ; Lowercase [success] ConsoleWrite(Execute('0x07aFbFeF4FF55FF0') & @LF) ; Mixture [success] ConsoleWrite(@LF & 'Number()' & @LF) ; Number() appears to be case sensitive ConsoleWrite(Number('0x07AFBFEF4FF55FF0') & @LF) ; Uppercase [success] ConsoleWrite(Number('0x07afbfef4ff55ff0') & @LF) ; Lowercase [failure] ??? ConsoleWrite(Number('0x07aFbFeF4FF55FF0') & @LF) ; Mixture [failure] ???
Attachments (0)
Change History (5)
comment:1 Changed 9 years ago by czardas
comment:2 Changed 9 years ago by anonymous
After getting nowhere fast, an angel came and whispered in my ear:
'The issue has nothing to do with lowercase string representation of binary data. The real issue is the letter "e", which is treated as a moniker (scientific e notation) for floats.'
ConsoleWrite(Number('0x07afbfaf4ff55ff0') & @LF)
comment:3 Changed 9 years ago by jchd18
This angel was slightly drunk: in fact, Number has two distinct bugs, both related to case sensivity.
First it interprets '1E2' and '1e2' differently, '1E2' being converted to 1 (wrong) instead of 100.
Second, it interprets any 'e' digit of hex values having more than 8 hex digits case-sensitively, with for instance '0x0000001E2' --> 482 (correct) but '0x0000001e2' --> 0
ConsoleWrite("Testing 1E2 --> ") ConsoleWrite(1E2 & @LF) ConsoleWrite("Testing 1e2 --> ") ConsoleWrite(1e2 & @LF) ConsoleWrite("Testing 0x1E2 --> ") ConsoleWrite(0x1E2 & @LF) ConsoleWrite("Testing 0x1e2 --> ") ConsoleWrite(0x1e2 & @LF) ConsoleWrite("Testing 0x0000001E2 --> ") ConsoleWrite(0x0000001E2 & @LF) ConsoleWrite("Testing 0x0000001e2 --> ") ConsoleWrite(0x0000001e2 & @LF) ConsoleWrite(@LF) ConsoleWrite("Testing Execute(1E2) --> ") ConsoleWrite(Execute(1E2) & @LF) ConsoleWrite("Testing " & "Execute(1e2) --> ") ConsoleWrite(Execute(1e2) & @LF) ConsoleWrite("Testing Execute('1E2') --> ") ConsoleWrite(Execute('0x1E2') & @LF) ConsoleWrite("Testing Execute('1e2') --> ") ConsoleWrite(Execute('0x1e2') & @LF) ConsoleWrite("Testing Execute('0x0000001E2') --> ") ConsoleWrite(Execute('0x0000001E2') & @LF) ConsoleWrite("Testing Execute('0x0000001e2') --> ") ConsoleWrite(Execute('0x0000001e2') & @LF) ConsoleWrite(@LF) ConsoleWrite("Testing Number('1E2') --> ") ConsoleWrite(Number('1E2') & @LF) ; Uppercase [failure] ConsoleWrite("Testing Number('1e2') --> ") ConsoleWrite(Number('1e2') & @LF) ; Lowercase [success] ConsoleWrite("Testing Number('0x1E2') -- > ") ConsoleWrite(Number('0x1E2') & @LF) ConsoleWrite("Testing Number('0x1e2') -- > ") ConsoleWrite(Number('0x1e2') & @LF) ConsoleWrite("Testing Number('0x000001E2') --> " ) ConsoleWrite(Number('0x000001E2') & @LF) ConsoleWrite("Testing Number('0x000001e2') --> " ) ConsoleWrite(Number('0x000001e2') & @LF) ConsoleWrite("Testing Number('0x0000001E2') --> " ) ConsoleWrite(Number('0x0000001E2') & @LF) ; Uppercase [success] ConsoleWrite("Testing Number('0x0000001e2') --> " ) ConsoleWrite(Number('0x0000001e2') & @LF) ; Lowercase [failure] ConsoleWrite("Testing Number('0x0000001F2') --> " ) ConsoleWrite(Number('0x0000001F2') & @LF) ConsoleWrite("Testing Number('0x0000001f2') --> " ) ConsoleWrite(Number('0x0000001f2') & @LF)
comment:4 Changed 4 years ago by Jpm
- Owner set to Jpm
- Status changed from new to assigned
Hi
Fix send to Jon
comment:5 Changed 4 years ago by Jon
- Milestone set to 3.3.15.4
- Owner changed from Jpm to Jon
- Resolution set to Fixed
- Status changed from assigned to closed
Fixed by revision [12549] in version: 3.3.15.4
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.
I forgot to mention that there is more information on the private MVP forum : https://www.autoitscript.com/forum/topic/178945-conversion-to-number/#comment-1284838
It is $NUMBER_AUTO flag which is not behaving the same way the interpreter does.