elf: Ignore LD_LIBRARY_PATH and debug env var for setuid for static
[glibc.git] / sysdeps / ieee754 / flt-32 / s_logbf.c
blobb027e7b9c24eae95bebd0958555572ccdbcb1092
1 /* s_logbf.c -- float version of s_logb.c.
2 */
4 /*
5 * ====================================================
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 * Developed at SunPro, a Sun Microsystems, Inc. business.
9 * Permission to use, copy, modify, and distribute this
10 * software is freely granted, provided that this notice
11 * is preserved.
12 * ====================================================
15 #include <math.h>
16 #include <math_private.h>
17 #include <libm-alias-float.h>
18 #include <fix-int-fp-convert-zero.h>
19 #include <math-use-builtins.h>
21 float
22 __logbf (float x)
24 #if USE_LOGBF_BUILTIN
25 return __builtin_logbf (x);
26 #else
27 int32_t ix, rix;
29 GET_FLOAT_WORD (ix, x);
30 ix &= 0x7fffffff; /* high |x| */
31 if (ix == 0)
32 return (float) -1.0 / fabsf (x);
33 if (ix >= 0x7f800000)
34 return x * x;
35 if (__glibc_unlikely ((rix = ix >> 23) == 0))
37 /* POSIX specifies that denormal number is treated as
38 though it were normalized. */
39 rix -= __builtin_clz (ix) - 9;
41 if (FIX_INT_FP_CONVERT_ZERO && rix == 127)
42 return 0.0f;
43 return (float) (rix - 127);
44 #endif /* ! USE_LOGBF_BUILTIN */
46 libm_alias_float (__logb, logb)