Use of C99 extra long double math functions after r236148

Steve Kargl sgk at troutmask.apl.washington.edu
Sun Aug 12 22:58:35 UTC 2012


On Fri, Jul 20, 2012 at 02:12:20PM +1000, Bruce Evans wrote:
> On Thu, 19 Jul 2012, Steve Kargl wrote:
> 
> >I collected some of the float and double into a cheat sheet.
> >
> >Idioms used in libm with float type:
> >
> > int32_t xsb;
> > u_int32_t hx;
> >
> > GET_FLOAT_WORD(hx, x);
> >
> > /* Get the sign bit of x */
> > xsb = (hx >> 31) & 1;
> 
> Getting it without shifting it (hx & 0x8000) is more efficient and common.
> You don't need to shift it in this example.

I collected these from msun/src, when I was trying to understand
the magic numbers.  I suppose someone should audit the code for
consistency. :-)

laptop:kargl[219] grep " (hx>>31)&1" *c
e_exp.c:        xsb = (hx>>31)&1;               /* sign bit of x */
e_expf.c:       xsb = (hx>>31)&1;               /* sign bit of x */

-- 
Steve


More information about the freebsd-numerics mailing list