I remember from my schooldays the method you described can be used to convert
a decimal number to a number of any base/radix. To change to octal you just
multiply be 8 rather than 16....etc...
Andy orlando St.Clair
Printable View
I remember from my schooldays the method you described can be used to convert
a decimal number to a number of any base/radix. To change to octal you just
multiply be 8 rather than 16....etc...
Andy orlando St.Clair
Apparently, there are two schools of thought concerning this question.
Do you want a string representing a double converted to a string representing hex
or a binary double value converted to a string representing hex or what ?
Gomez
PS.- this new board doesn't like me using my 'real' name
It seems to me this is a question of 'is a readability important ?'
I assumed that it wasn't. My solution will exactly convert the values
of any data type to and from a hex string. The hex string is written
in the same order that the data appears in memory. I don't consider
it important or even useful to be able to read the hex digits of a floating
point value. The only use I can conceive of for this kind of thing is to
convert binary data into an ASCII representation for storage or
transmission. In this case I think accuracy is the highest priority.
This scheme will even handle data having an enormous dynamic
range like 3.5E201 or -2.6E-199 and use only 16 characters to do
it instead of 400.
Maybe I am reading more into the poster's question than I should.
I did post a question asking them exactly what they were after but
I haven't seen a response. Oh well, different strokes ...