Back to index

glibc  2.9
w_log2.c
Go to the documentation of this file.
00001 /*
00002  * wrapper log2(X)
00003  */
00004 
00005 #include <math.h>
00006 #include "math_private.h"
00007 
00008 double
00009 __log2 (double x)    /* wrapper log2 */
00010 {
00011 #ifdef _IEEE_LIBM
00012   return __ieee754_log2 (x);
00013 #else
00014   double z;
00015   z = __ieee754_log2 (x);
00016   if (_LIB_VERSION == _IEEE_ || __isnan (x)) return z;
00017   if (x <= 0.0)
00018     {
00019       if (x == 0.0)
00020        return __kernel_standard (x, x, 48); /* log2 (0) */
00021       else
00022        return __kernel_standard (x, x, 49); /* log2 (x < 0) */
00023     }
00024   else
00025     return z;
00026 #endif
00027 }
00028 weak_alias (__log2, log2)
00029 #ifdef NO_LONG_DOUBLE
00030 strong_alias (__log2, __log2l)
00031 weak_alias (__log2, log2l)
00032 #endif