1 /* wf_log2.c -- float version of s_log2.c.
2  * Modification of sf_exp10.c by Yaakov Selkowitz 2009.
3  */
4 
5 /*
6  * ====================================================
7  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8  *
9  * Developed at SunPro, a Sun Microsystems, Inc. business.
10  * Permission to use, copy, modify, and distribute this
11  * software is freely granted, provided that this notice
12  * is preserved.
13  * ====================================================
14  */
15 
16 /*
17  * wrapper log2f(x)
18  */
19 
20 #include "fdlibm.h"
21 #if __OBSOLETE_MATH_FLOAT
22 #include <errno.h>
23 #include <math.h>
24 #undef log2
25 #undef log2f
26 
27 static const float log2_inv = 1.0f / (float) M_LN2;
28 
29 float
log2f(float x)30 log2f(float x) /* wrapper log2f */
31 {
32     return logf(x) * log2_inv;
33 }
34 
35 _MATH_ALIAS_f_f(log2)
36 
37 #else
38 #include "../common/sf_log2.c"
39 #endif /* __OBSOLETE_MATH_FLOAT */
40