This is the mail archive of the
mailing list for the GCC project.
Re: Floating Point Representation in libgcc (is IEEE?)
Quoting "Paulo J. Matos" <email@example.com>:
I am implementing some function for conversion between modes (QI ->
HF, SF -> HI, etc). For this it would be useful to know the floating
point representation using in libgcc. However, I can't find any
description of it anywhere. Is it using IEEE floating point
It is using whatever floating point format the target has.
If you don't have hardware floating point support, then you get to
choose the format when you design your ABI.
Of course, basing the floating point format on IEEE is a popular choice,
albeit it is common to cut corners on subnormals / rounding modes / signals.
(This is merely an observation, not advocating for or against these
There are two C implementations of IEEE software floating point in the
- fp-bit.c, which is fairly old and slow, but requires little work to use
if longlong.h supports your processor (which is also needed for GNU mp).
It only has round-to-nearest, no signals, but subnormals work except for
one rounding issue with division.
- soft-fp. This is supposed to be a bit faster, but you need to define
various primitives. The default configuration is similar in features
to fp-bit.c, but you can customize it for support of signals ('exceptions')
and other rounding modes.
Some targets also have their own implementation in optimized assembly code.