Problem converting HEX to Decimal
Posted on 2005-03-23
This is a strange one...I am converting a hex number to decimal (from a serial stream, imagine that for those of you that have been following along at home), and as long as the number begins with a numeric number (0-9), it converts the number just fine. BUT, if it starts with an alpha character, it gives me some odd ball negative number. Anybody know why?
Here is the code:
strHex8 = SplitUpString(8)
ElapsedTime = (Val("&H" & strHex8) * 0.0001) / 3600
CE4A converts to -0.0003535...
2ED5 converts correctly to 0.000330277777777777777777...
What am I doing wrong?