]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Math/w_pow.c
Fix a bug about the iSCSI DHCP dependency issue.
[mirror_edk2.git] / StdLib / LibC / Math / w_pow.c
CommitLineData
2aa62f2b 1\r
2\r
3/* @(#)w_pow.c 5.2 93/10/01 */\r
4/*\r
5 * ====================================================\r
6 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.\r
7 *\r
8 * Developed at SunPro, a Sun Microsystems, Inc. business.\r
9 * Permission to use, copy, modify, and distribute this\r
10 * software is freely granted, provided that this notice\r
11 * is preserved.\r
12 * ====================================================\r
13 */\r
14#include <LibConfig.h>\r
15#include <sys/EfiCdefs.h>\r
16#if defined(LIBM_SCCS) && !defined(lint)\r
17__RCSID("$NetBSD: w_pow.c,v 1.7 2002/05/26 22:02:02 wiz Exp $");\r
18#endif\r
19\r
20/*\r
21 * wrapper pow(x,y) return x**y\r
22 */\r
23\r
24#include "math.h"\r
25#include "math_private.h"\r
26\r
27\r
28double\r
29pow(double x, double y) /* wrapper pow */\r
30{\r
31#ifdef _IEEE_LIBM\r
32 return __ieee754_pow(x,y);\r
33#else\r
34 double z;\r
35 z=__ieee754_pow(x,y);\r
36 if(_LIB_VERSION == _IEEE_|| isnan(y)) return z;\r
37 if(isnan(x)) {\r
38 if(y==0.0)\r
39 return __kernel_standard(x,y,42); /* pow(NaN,0.0) */\r
40 else\r
41 return z;\r
42 }\r
43 if(x==0.0){\r
44 if(y==0.0)\r
45 return __kernel_standard(x,y,20); /* pow(0.0,0.0) */\r
46 if(finite(y)&&y<0.0)\r
47 return __kernel_standard(x,y,23); /* pow(0.0,negative) */\r
48 return z;\r
49 }\r
50 if(!finite(z)) {\r
51 if(finite(x)&&finite(y)) {\r
52 if(isnan(z))\r
53 return __kernel_standard(x,y,24); /* pow neg**non-int */\r
54 else\r
55 return __kernel_standard(x,y,21); /* pow overflow */\r
56 }\r
57 }\r
58 if(z==0.0&&finite(x)&&finite(y))\r
59 return __kernel_standard(x,y,22); /* pow underflow */\r
60 return z;\r
61#endif\r
62}\r