Opened 11 years ago
Closed 11 years ago
#2642 closed Bug (No Bug)
The function Hex() returns the wrong value
Reported by: | Cythor | Owned by: | |
---|---|---|---|
Milestone: | Component: | AutoIt | |
Version: | 3.3.10.2 | Severity: | None |
Keywords: | Cc: |
Description
The code says all what I mean.
$var = BitAND(1529, 65280) / 256 ; = 5 ConsoleWrite(Hex($var) & @CRLF) ; ?
Attachments (0)
Change History (8)
comment:1 Changed 11 years ago by jchd18
comment:2 Changed 11 years ago by BrewManNH
Why is it being turned into a Double though I think is the question. Neither number is a floating point so I don't understand why it's happening.
comment:3 Changed 11 years ago by jchd18
Agreed, that would be the right subject for a ticket. But that was not the issue raised by he OP.
comment:4 Changed 11 years ago by Melba23
Surely the result of any calculation involving a division has to be a double as AutoIt has no way of knowing that an integer will be returned and so must assume that the value will be fractional.
This code gives the same result:
$var = 256 * 5 / 256 ConsoleWrite(VarGetType($var) & ' = 0x' & Hex($var) & ' = ' & $var & @CRLF)
which to my eyes is entirely expected.
M23
comment:5 Changed 11 years ago by anonymous
Turning 1/1 into a double is utter tech perversion, period.
1.0/1 or 1/1.0 as double is expected and necessary in some circumstances, but certainly not 1/1.
Anyway this isn't the place to discuss junk food.
comment:6 Changed 11 years ago by jchd18
I keep being disconnected, but it was me above.
0/1 also a double, of course... geez.
comment:7 Changed 11 years ago by czardas
The following post by me appears to be related.
http://www.autoitscript.com/forum/topic/161396-lamus/?p=1174073
comment:8 Changed 11 years ago by Melba23
- Resolution set to No Bug
- Status changed from new to closed
I am closing this ticket as there is no problem with Hex - the seemingly invalid returns are caused by the inadvertent use of doubles instead of integers as the argument. That is covered by this ticket:
http://www.autoitscript.com/trac/autoit/ticket/2729
M23
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.
See Hex() help.