1 /* @(#)s_logb.c 5.1 93/09/24 */
2 /* $FreeBSD: head/lib/msun/src/s_logb.c 176101 2008-02-08 01:22:13Z bde $ */
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
11 * ====================================================
16 * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
23 #include "math_private.h"
26 two54 = 1.80143985094819840000e+16; /* 43500000 00000000 */
32 EXTRACT_WORDS(ix,lx,x);
33 ix &= 0x7fffffff; /* high |x| */
34 if((ix|lx)==0) return -1.0/fabs(x);
35 if(ix>=0x7ff00000) return x*x;
37 x *= two54; /* convert subnormal x to normal */
40 return (double) ((ix>>20)-1023-54);
42 return (double) ((ix>>20)-1023);
45 #if (LDBL_MANT_DIG == 53)
46 __weak_reference(logb, logbl);