]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Math/w_exp.c
ArmPkg: ArmLib: purge incorrect ArmDrainWriteBuffer () alias
[mirror_edk2.git] / StdLib / LibC / Math / w_exp.c
CommitLineData
2aa62f2b 1/* @(#)w_exp.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_exp.c,v 1.9 2002/05/26 22:02:00 wiz Exp $");\r
16#endif\r
17\r
18/*\r
19 * wrapper exp(x)\r
20 */\r
21\r
22#include "math.h"\r
23#include "math_private.h"\r
24\r
25static const double\r
26o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */\r
27u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */\r
28\r
29double\r
30exp(double x) /* wrapper exp */\r
31{\r
32#ifdef _IEEE_LIBM\r
33 return __ieee754_exp(x);\r
34#else\r
35 double z;\r
36 z = __ieee754_exp(x);\r
37 if(_LIB_VERSION == _IEEE_) return z;\r
38 if(finite(x)) {\r
39 if(x>o_threshold)\r
40 return __kernel_standard(x,x,6); /* exp overflow */\r
41 else if(x<u_threshold)\r
42 return __kernel_standard(x,x,7); /* exp underflow */\r
43 }\r
44 return z;\r
45#endif\r
46}\r