source: trunk/sys/libm/w_exp.c @ 265

Last change on this file since 265 was 1, checked in by alain, 8 years ago

First import

File size: 1.1 KB
Line 
1
2/* @(#)w_exp.c 5.1 93/09/24 */
3/*
4 * ====================================================
5 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
6 *
7 * Developed at SunPro, a Sun Microsystems, Inc. business.
8 * Permission to use, copy, modify, and distribute this
9 * software is freely granted, provided that this notice
10 * is preserved.
11 * ====================================================
12 */
13
14/*
15 * wrapper exp(x)
16 */
17
18#include <libm/fdlibm.h>
19
20#ifdef __STDC__
21static const double
22#else
23static double
24#endif
25o_threshold=  7.09782712893383973096e+02,  /* 0x40862E42, 0xFEFA39EF */
26u_threshold= -7.45133219101941108420e+02;  /* 0xc0874910, 0xD52D3051 */
27
28#ifdef __STDC__
29        double exp(double x)            /* wrapper exp */
30#else
31        double exp(x)                   /* wrapper exp */
32        double x;
33#endif
34{
35#ifdef _IEEE_LIBM
36        return __ieee754_exp(x);
37#else
38        double z;
39        z = __ieee754_exp(x);
40        if(_LIB_VERSION == _IEEE_) return z;
41        if(finite(x)) {
42            if(x>o_threshold)
43                return __kernel_standard(x,x,6); /* exp overflow */
44            else if(x<u_threshold)
45                return __kernel_standard(x,x,7); /* exp underflow */
46        } 
47        return z;
48#endif
49}
Note: See TracBrowser for help on using the repository browser.