what's this constant ?

Ian Lance Taylor iant@google.com
Mon Feb 5 20:28:00 GMT 2007


"Michael Gong" <mwgong@cs.utoronto.ca> writes:

> I saw following function definition in libgcc2.c.
> 
> ...
> 
> DFtype
> __floatdidf (DItype u)
> {
>   DFtype d = (SItype) (u >> (4 * 8));
>   d *= 0x1p32f;
>   d += (USItype)u;
>   return d;
> }
> 
> Can anyone tell me what's the constant "0x1p32f" ? Is it a decimal
> floating pointer constant ?

It is a single precision hexadecimal floating point constant.  This is
a feature introduced into the language by the C99 standard.  See ISO
C99 section 6.4.4.2.

The value of 0x1p32f is 2^32 == 4294967296.

Ian



More information about the Gcc-help mailing list