]> git.ipfire.org Git - thirdparty/glibc.git/blob - math/w_exp2f.c
2005-12-13 Ulrich Drepper <drepper@redhat.com>
[thirdparty/glibc.git] / math / w_exp2f.c
1 /*
2 * wrapper exp2f(x)
3 */
4
5 #include <float.h>
6 #include <math.h>
7 #include "math_private.h"
8
9 static const float o_threshold= (float) FLT_MAX_EXP;
10 static const float u_threshold= (float) (FLT_MIN_EXP - FLT_MANT_DIG - 1);
11
12 float
13 __exp2f (float x) /* wrapper exp2f */
14 {
15 #ifdef _IEEE_LIBM
16 return __ieee754_exp2f (x);
17 #else
18 float z;
19 z = __ieee754_exp2f (x);
20 if (_LIB_VERSION != _IEEE_ && __finitef (x))
21 {
22 if (x > o_threshold)
23 /* exp2 overflow */
24 return (float) __kernel_standard ((double) x, (double) x, 144);
25 else if (x <= u_threshold)
26 /* exp2 underflow */
27 return (float) __kernel_standard ((double) x, (double) x, 145);
28 }
29 return z;
30 #endif
31 }
32 weak_alias (__exp2f, exp2f)