-1
$\begingroup$

I have a hexadecimal to float converter in the form of a code by I am unable to understand as to how did they carry out the conversion.

For Ex: If I have a hexadecimal number as : 11433333; the answer I get from that function is: 145.200.

I tried several methods of conversion like these:

http://www.cs.uaf.edu/~cs301/notes/Chapter4/node13.html

http://babbage.cs.qc.edu/IEEE-754/32bit.html

There is something to do with little endian and big endian, but I am not familiar with that. None of these are giving me the output as 145.200. Could anyone explain me a way out of this please?

Cheers in advance.

  • 0
    Which is it, 145.200 or 145.2200? While you're at it, please check whether there's a typo in the hexadecimal number.2011-08-26
  • 0
    145.2200 is a float value that is generated as an output from the function. There is no typo, everything is fine. I get float values from other hexadecimal input as well.2011-08-26
  • 0
    It's bad enough that there's an obvious typo in your question. I don't see why anyone should bother spending time on answering your question if you don't even take the time to check it after the typo has been pointed out to you.2011-08-26
  • 0
    Sorry, my bad. It is 145.200.2011-08-26

1 Answers 1

1

The mystery is resolved when you do the conversion the other way around: the IEEE representation of 145.2 is 43 11 33 3316. So some part of your code is getting the byte order mixed up.

  • 0
    Thanks a lot. I was just going through that. Glad you told me earlier. It saved me a bunch of calculations. :) Cheers.2011-08-26
  • 0
    IIRC, that's exactly the difference between "little endian" and "big endian". They will switch the order of bytes within a word.2015-05-06