1 /* @(#)s_logb.c 5.1 93/09/24 */
3 * ====================================================
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 * Developed at SunPro, a Sun Microsystems, Inc. business.
7 * Permission to use, copy, modify, and distribute this
8 * software is freely granted, provided that this notice
10 * ====================================================
15 * IEEE 754 logb. Included to pass IEEE test suite. Not recommend.
20 #include <math_private.h>
27 EXTRACT_WORDS (ix
, lx
, x
);
28 ix
&= 0x7fffffff; /* high |x| */
30 return -1.0 / fabs (x
);
33 if (__builtin_expect ((rix
= ix
>> 20) == 0, 0))
35 /* POSIX specifies that denormal number is treated as
36 though it were normalized. */
39 ma
= __builtin_clz (lx
) + 32;
41 ma
= __builtin_clz (ix
);
44 return (double) (rix
- 1023);
46 weak_alias (__logb
, logb
)
48 strong_alias (__logb
, __logbl
) weak_alias (__logb
, logbl
)