Print &HFFF Returns 4095
Print &HFFFF Returns -1 not 65535
Print &HFFFFF Returns 1048575
Am I missing something here?
Hexadecimal to Decimal
Re: Hexadecimal to Decimal
Byte 0 … 255 1 Byte
Short -32.768 … +32.767 2 Bytes
Integer -2.147.483.648 … +2.147.483.647 4 Bytes
Long -9.223.372.036.854.775.808 … +9.223.372.036.854.775.807 8 Bytes
Print &HFFF nearest fitting data type = short -> Returns 4095
Print &HFFFF nearest fitting data type = short -> Returns -1 (which is correct)
Print &HFFFFF nearest fitting data type = integer -> Returns 1048575
Short -32.768 … +32.767 2 Bytes
Integer -2.147.483.648 … +2.147.483.647 4 Bytes
Long -9.223.372.036.854.775.808 … +9.223.372.036.854.775.807 8 Bytes
Print &HFFF nearest fitting data type = short -> Returns 4095
Print &HFFFF nearest fitting data type = short -> Returns -1 (which is correct)
Print &HFFFFF nearest fitting data type = integer -> Returns 1048575
Re: Hexadecimal to Decimal
Yes, I think its a casting problem. Adding a trailing "&" seems to sort it out:-
&hffff&
&hffff&
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Hexadecimal to Decimal
Thanks, that extra '00' works but why?