This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: help with the conception of floating point
- From: Ian Lance Taylor <ian at airs dot com>
- To: Eric Fisher <joefoxreal at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 20 Jan 2006 20:20:21 -0800
- Subject: Re: help with the conception of floating point
- References: <d6afecde0601192218s19f2b6edy@mail.gmail.com>
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