Try:
local $hexA = hex(1,2)
local $hexB = hex(140,2)
ConsoleWrite( $hexA& @CRLF)
ConsoleWrite( $hexB& @CRLF)
$hexC = $hexB - $hexA
ConsoleWrite( $hexC& @CRLF)
Output:
01
8C
7
I'm not crazy right?
Autoit v3.3.12.0 x86
Edit:
This is the only way I found it works:
local $hexA = hex(1,2)
local $hexB = hex(140,2)
ConsoleWrite( $hexA& @CRLF)
ConsoleWrite( $hexB& @CRLF)
$hexC = Hex(Execute('0x'&$hexB&' - 0x'&$hexA),2)
ConsoleWrite( $hexC& @CRLF)
Output:
01
8C
8B
Well this is not a bug but this IS very inconvenient. I mean hex should be fast and easy...
Workaround:
ALWAYS do operations with as - + * / with a hex variable (string) that already is in a form of "0xAF".
You can NOT:
$hexC = '0x'&$hexB - '0x'&$hexA
but you CAN:
$hexC = ('0x'&$hexB) - ('0x'&$hexA)