The floating point format is specified within the
newlib
directory in
libc/include/machine/ieeefp.h
. Details of how
the IEEE 754 format is implemented, and variations from the
standard, are specified by defining a number of C macros.
__IEEE_BIG_ENDIAN
Define this macro if the floating point format is big endian.
Caution | |
---|---|
One, and only one of |
__IEEE_LITTLE_ENDIAN
Define this macro if the floating point format is little endian.
Caution | |
---|---|
One, and only one of |
__IEEE_BYTES_LITTLE_ENDIAN
Define this macro in addition to
__IEEE_BIG_ENDIAN
, where the words of a
multi-word IEEE floating point number are in big endian
order, but the bytes within each word are in little endian
order.
_DOUBLE_IS_32BITS
Define this if double precision floating point is represented using the 32-bit IEEE representation.
_FLOAT_ARG
Floating point arguments are usually promoted to double when passed as arguments. If this is not the case, then this macro should be defined to the type actually used to pass floating point arguments.
_FLT_LARGEST_EXPONENT_IS_NORMAL
Define this if the floating point format uses the largest
exponent for finite numbers rather than NaN and
infinities. Such a format cannot represent NaNs or infinities,
but it's FLT_MAX
is twice the standard IEEE
value.
_FLT_NO_DENORMALS
Define this if the floating point format does not support IEEE denormalized numbers. In this case, every floating point number with a zero exponent is treated as a zero representation.
Caution | |
---|---|
Two of these macros
( |
For most targets it is sufficient to define just one of
__IEEE_BIG_ENDIAN
or
__IEEE_LITTLE_ENDIAN
. The definitions should
always be surrounded by a conditional, so they are only used when
the target architecture is selected. For example the OpenRISC 1000 is
big-endian, so we add the following to the header file.
#if defined(__or32__) #define __IEEE_BIG_ENDIAN #endif