]> git.proxmox.com Git - mirror_edk2.git/blame - StdLib/LibC/Math/w_exp.c
StdLib: GCC 6 build fixes
[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
65ed9d7f 25#ifndef _IEEE_LIBM\r
2aa62f2b 26static const double\r
27o_threshold= 7.09782712893383973096e+02, /* 0x40862E42, 0xFEFA39EF */\r
28u_threshold= -7.45133219101941108420e+02; /* 0xc0874910, 0xD52D3051 */\r
65ed9d7f 29#endif\r
2aa62f2b 30\r
31double\r
32exp(double x) /* wrapper exp */\r
33{\r
34#ifdef _IEEE_LIBM\r
35 return __ieee754_exp(x);\r
36#else\r
37 double z;\r
38 z = __ieee754_exp(x);\r
39 if(_LIB_VERSION == _IEEE_) return z;\r
40 if(finite(x)) {\r
41 if(x>o_threshold)\r
42 return __kernel_standard(x,x,6); /* exp overflow */\r
43 else if(x<u_threshold)\r
44 return __kernel_standard(x,x,7); /* exp underflow */\r
45 }\r
46 return z;\r
47#endif\r
48}\r