]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Math/w_log2.c
ArmPkg: ArmLib: purge incorrect ArmDrainWriteBuffer () alias
[mirror_edk2.git] / StdLib / LibC / Math / w_log2.c
CommitLineData
2aa62f2b 1/* @(#)w_log10.c 5.1 93/09/24 */\r
2/*\r
3 * ====================================================\r
4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
5 *\r
6 * Developed at SunPro, a Sun Microsystems, Inc. business.\r
7 * Permission to use, copy, modify, and distribute this\r
8 * software is freely granted, provided that this notice\r
9 * is preserved.\r
10 * ====================================================\r
11 */\r
12#include <LibConfig.h>\r
13#include <sys/EfiCdefs.h>\r
14#if defined(LIBM_SCCS) && !defined(lint)\r
15__RCSID("$NetBSD: w_log2.c,v 1.1 2005/07/21 16:58:39 christos Exp $");\r
16#endif\r
17\r
18/*\r
19 * wrapper log2(X)\r
20 */\r
21\r
22#include "math.h"\r
23#include "math_private.h"\r
24\r
25\r
26double\r
27log2(double x) /* wrapper log10 */\r
28{\r
29#ifdef _IEEE_LIBM\r
30 return __ieee754_log2(x);\r
31#else\r
32 double z;\r
33 z = __ieee754_log2(x);\r
34 if(_LIB_VERSION == _IEEE_ || isnan(x)) return z;\r
35 if(x<=0.0) {\r
36 if(x==0.0)\r
37 return __kernel_standard(x,x,48); /* log2(0) */\r
38 else\r
39 return __kernel_standard(x,x,49); /* log2(x<0) */\r
40 } else\r
41 return z;\r
42#endif\r
43}\r