Hexadecimal to Decimal conversion

Started by Intrigue, December 20, 2005, 05:49:03 AM

Previous topic - Next topic

Intrigue

Another thing that the MSDN library wasn't too clear on when I searched; after scouring the Internet and rejecting the huge functions, I found this very easy method:

dec=val("&h" & hex)

I tried a similar approach, but managed to forget to add the "&h" first!

Intrigue

sarge

dim x as double
x = val("&hFFFFFFFF)

X should be 4294967295, but it's calculated as -1.  This is a problem with the HEX function, it won't work over 7FFFFFFF.  Even adding the "&" at the end doesn't force a 32 bit calculation, even if the variable will hold a 64 bit number.

Sarge

Intrigue

Thanks Sarge, nice to know someone's still alive after Christmas!

Intrigue