Back to index

glibc  2.9
w_exp2.c
Go to the documentation of this file.
00001 /*
00002  * wrapper exp2(x)
00003  */
00004 
00005 #include <float.h>
00006 #include <math.h>
00007 #include "math_private.h"
00008 
00009 static const double o_threshold= (double) DBL_MAX_EXP;
00010 static const double u_threshold= (double) (DBL_MIN_EXP - DBL_MANT_DIG - 1);
00011 
00012 double
00013 __exp2 (double x)           /* wrapper exp2 */
00014 {
00015 #ifdef _IEEE_LIBM
00016   return __ieee754_exp2 (x);
00017 #else
00018   double z;
00019   z = __ieee754_exp2 (x);
00020   if (_LIB_VERSION != _IEEE_ && __finite (x))
00021     {
00022       if (x > o_threshold)
00023        /* exp2 overflow */
00024        return __kernel_standard (x, x, 44);
00025       else if (x <= u_threshold)
00026        /* exp2 underflow */
00027        return __kernel_standard (x, x, 45);
00028     }
00029   return z;
00030 #endif
00031 }
00032 weak_alias (__exp2, exp2)
00033 #ifdef NO_LONG_DOUBLE
00034 strong_alias (__exp2, __exp2l)
00035 weak_alias (__exp2, exp2l)
00036 #endif