Opened 13 years ago
Closed 11 years ago
#2152 closed Bug (Fixed)
X^2 Not Working in Hex()
Reported by: | tobgle@… | Owned by: | Jon |
---|---|---|---|
Milestone: | 3.3.9.21 | Component: | AutoIt |
Version: | 3.3.8.1 | Severity: | None |
Keywords: | Hex | Cc: |
Description
In 3.3.8.1 This returns 000000, but it should return FFFFFF
Hex(255*2562+255*256+255, 6)
Attachments (0)
Change History (6)
comment:1 Changed 13 years ago by Valik
comment:2 Changed 13 years ago by trancexx
It was expected that some users will have problems with changed behavior of Hex() function.
The main problem here is not the Hex() function, it's the math. Integer times integer is still integer, but integer to (integer) exponent is automatically changed in type. Arguing that behavior is more correct than arguing Hex()'s.
comment:3 Changed 13 years ago by Valik
While I do not disagree that the problem is in places other than Hex() I do not find it very fair to leave the burden on users to find and report all the places we have broken their scripts in completely unexpected ways. We need to either adjust Hex()'s behavior so old scripts still work or somebody (not me) needs to go through the code very thoroughly and ensure conversions to Double only happen when it really needs to happen.
comment:4 Changed 11 years ago by Jon
- Resolution set to Rejected
- Status changed from new to closed
comment:5 Changed 11 years ago by Jpm
- Resolution Rejected deleted
- Status changed from closed to reopened
In fact integerinteger should return an integer
comment:6 Changed 11 years ago by Jon
- Milestone set to 3.3.9.21
- Owner set to Jon
- Resolution set to Fixed
- Status changed from reopened to closed
Fixed by revision [8993] in version: 3.3.9.21
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.
And thus trancexx learns about the law of unintended consequences. The problem is the math you are performing is done as floating point and Hex() now returns the hex representation of a floating point number which is not the same as the hex representation of an integer in cases where you are dealing with a whole floating point number.
This is technically not a bug but it is certainly not expected by the general user, either.