This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Float hex representation



Hi all, This might be a silly problem, but I'm stumped. I'm trying to save floats to my FRAM memory. The floats are calculated correctly but they end up backwards. For example 110 is 0x42DC0000 in hex but it's saving as 0x0000DC42 Any thoughts on how to fix this? Thanks!
  • Which end do you crack your boiled egg first? The big end or the small end?

    Ever heard about Lilliput and Blefuscu? About Big-Endian and Little-Endian? It may be silly, but they fought a war over this.

  • Joseph Boruch said:
    For example 110 is 0x42DC0000 in hex but it's saving as 0x0000DC42

    If reality doesn't fit your imagination, change your imagination and do not try to change reality. The first will make you smarter, the second will make you mad.

    It doesn't matter how floats are saved. As long as the compiler knows how they are saved and how they are used. 'float' is a type. As such, it is atomic and you shouldn't make any assumptions about implementation. Or storage. If you care, write in a low-level language like assembly language.

**Attention** This is a public forum