-
2.15 in Hex??
I search into the tutorial and I didn't find anything about it so I'll ask. It's 1:16am, so if you tell me my writing sucks because at this time, well, you guest!
I know how to convert binary, decimal and hex. That no problem for me usually because I always work with "full number" like 1, 354 and 348 and never with "partial number" like 2.24, 354.45 and 348,93.
How do you convert those "partial number" into hex?
Thank you!
-
I dont believe you can, but try removing the decsimal and solve it that way and then replace descimal.
-
Hi
2.15 = 4009999A (32 bit precision)
2.15 = 4001333333333333 (64 bit precision)
...
Yes, you can, but it is a matter of the definition. Everything you need is regulated in
IEEE-754, however it's rather technical. Its elaboration would really make a tutorial.
However, one has to keep in mind that a number like 1.12 actually can be written
as
1.12 = 1 *10^0 + 1*10^{-1} + 2*^{-2}
which is, from a mathematical point of view, formally not different from
112 = 1 *10^2 + 1*10^{1} + 2*^{0}
so
1.12 = 112 * 10^{-2}
Examples of converters, inclusively a detailed explanation and further
readings can be found
dez -> hex[1]
hex -> dez[2]
Cheers
[1] http://babbage.cs.qc.edu/courses/cs341/IEEE-754.html
[2] http://babbage.cs.qc.edu/courses/cs3...-754hex32.html
-
My guess would be this:
in decimal, this 327.5 means:
3 times ten to the power of 2
2 times ten (to the power of 1) +
7 times one (or: ten to the power of 0) +
5 times one/tenth (or: ten to the power of -1)
added, this results in (no surprise here) 327.5
going hexidecimal:
3 times sixteen to the power of 2
2 times sixteen to the power of 1
7 times sixteen to the power of 0
5 times sixteen to the power of -1
Decimal results in ( 3 x 256) + ( 2x16 ) + ( 7x1 ) (5 x (1/16)) = 807 5/16 or 807.3125
so, hex 327.5 corresponds with 807.3125 decimal.
reversing that idea: 0.5 decimal would correspond with 0.8 hexidecimal.
two times 0.25 decimal is 0.5 decimal, and two times 0.4 hexidecimal = 0.8 hexidecimal
two times 0.5 decimal is 1 decimal, and two times 0.8 hexidecimal = 1 hexidecimal.
0.5 and 0.25 decimal = 0.75 decimal, while 0.4 and 0.8 hexidecimal = 0.C hexidecimal.
I a) hope that I'm right, and B) hope you got the idea :)
-
sec_ware, thank for link. I'll use it for now but when I have time, a tutorial on that would be nice because I don’t really understand why I get 4009999A at all. The conversation convert floating point to binary first and then to hex. I’m lost in the binary here.
Guus : You cannot write 327.5 Hex into a Hex Editor…