Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ho do I convert decimal to hex with a twist?
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00123780
Message ID:
00123813
Views:
20
>You're right about it only using integers. Hexadecimal values were used primarily for indicating the value stored in bytes, which, of course, are integers. How 'bout taking two fixed length values? Use BINTOC() to covert the integer portion, then raise the fractional portion by an appropriate power of 10 to covert that to an integer. Then use BINTOC() again and concatenate the results.

Hey Geo,
So ok this would work but one thought... ick ;)
We're looking at N 15,4 values, so binary would be a larger expression to store. But I took your thought and came up with this to do the same kind of thing but into hex:
original = 10.23
valuestored = transform(orignal * 10000, "@0")
originalval = val(valuestored)/10000
This allows the storage of numbers with 4 decimal places like we wanted. What do you think?
Roxanne M. Seibert
Independent Consultant, VFP MCP

Code Monkey Like Fritos
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform