This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: help with the conception of floating point


Eric Fisher <joefoxreal@gmail.com> writes:

> I guess that the macro NGARDS is relevant to the guard digit. But I
> still failed to have a clear conception about what it means. Others
> are easy to know by IEEE 754 and "What Every Computer Scientist Should
> Know about Floating-Point Arithmetic". Except,
> 
> define NGARDS 8L
> define GARDROUND 0x7f
> define GARDMASK  0xff
> define GARDMSB   0x80
> 
> what do these mean? :-)

NGARDS is the number of guard bits--as I recall you need at least two
guard bits, and beyond that fp-bit just fills out to the next byte
boundary.  GARDROUND is a mask for the bits - 1, GARDMASK is a mask
for the bits, GARDMSB is the most significant guard bit.

> Especially when unpack a signal floating point, the fraction takes
> such an operation at last, that make me much confused.
> dst->fraction.ll = (fraction << NGARDS) | IMPLICIT_1;

The left shift makes room for the guard bits.  The IMPLICIT_1 is the
implicit 1 found in the IEEE-754 floating point mantissa.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]