'Would float point format be affected by big-endian and little endian?

I know the integer format would be different between big-endian machine and little-endian machine, is it the same for float point format (IEEE 754)?



Solution 1:[1]

The IEEE754 specification for floating point numbers simply doesn't cover the endianness problem. Floating point numbers therefore may use different representations on different machines and, in theory, it's even possible that for two processors integer endianness is the same and floating point is different or vice-versa.

See this wikipedia article for more information.

Solution 2:[2]

If you have a Linux box, you'll probably have /usr/include/ieee754.h... (note the #ifs)

...
union ieee754_float
  {
    float f;

    /* This is the IEEE 754 single-precision format.  */
    struct
      {
#if     __BYTE_ORDER == __BIG_ENDIAN
        unsigned int negative:1;
        unsigned int exponent:8;
        unsigned int mantissa:23;
#endif                          /* Big endian.  */
#if     __BYTE_ORDER == __LITTLE_ENDIAN
        unsigned int mantissa:23;
        unsigned int exponent:8;
        unsigned int negative:1;
#endif                          /* Little endian.  */
      } ieee;
  ...

Solution 3:[3]

Endianness issues arise as soon as you consider something as made up of smaller units. The way the smaller units are arranged may change.

Then if you care about variations in FP format, you must be aware that IEEE 754 doesn't describe a FP representation (even if it one diagram suggest one), and there is at least one more variation than the one related to endianness: the bit denoting signaling subnormals is interpreted differently in different implementation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Artemis
Solution 2 Tony Delroy
Solution 3 AProgrammer