1: /* @(#)exp.c 4.1 12/25/82 */
2:
3: /*
4: exp returns the exponential function of its
5: floating-point argument.
6:
7: The coefficients are #1069 from Hart and Cheney. (22.35D)
8: */
9:
10: #include <errno.h>
11: #include <math.h>
12:
13: int errno;
14: static double p0 = .2080384346694663001443843411e7;
15: static double p1 = .3028697169744036299076048876e5;
16: static double p2 = .6061485330061080841615584556e2;
17: static double q0 = .6002720360238832528230907598e7;
18: static double q1 = .3277251518082914423057964422e6;
19: static double q2 = .1749287689093076403844945335e4;
20: static double log2e = 1.4426950408889634073599247;
21: static double sqrt2 = 1.4142135623730950488016887;
22: static double maxf = 10000;
23:
24: double
25: exp(arg)
26: double arg;
27: {
28: double fract;
29: double temp1, temp2, xsq;
30: int ent;
31:
32: if(arg == 0.)
33: return(1.);
34: if(arg < -maxf)
35: return(0.);
36: if(arg > maxf) {
37: errno = ERANGE;
38: return(HUGE);
39: }
40: arg *= log2e;
41: ent = floor(arg);
42: fract = (arg-ent) - 0.5;
43: xsq = fract*fract;
44: temp1 = ((p2*xsq+p1)*xsq+p0)*fract;
45: temp2 = ((1.0*xsq+q2)*xsq+q1)*xsq + q0;
46: return(ldexp(sqrt2*(temp2+temp1)/(temp2-temp1), ent));
47: }
Defined functions
exp
defined in line
24; used 66 times
- in /usr/include/math.h line
12
- in /usr/ingres/source/ovqp/interp.c line
32,
446
- in /usr/src/games/trek/events.c line
427
- in /usr/src/games/trek/trek.h line
36
- in /usr/src/games/warp/util.c line
71,
81-86(3)
- in /usr/src/include/math.h line
12
- in /usr/src/new/PORT/B/src/bint/b1fun.c line
466
- in /usr/src/new/PORT/B/src/bint/b1nuA.c line
158,
169,
205,
211
- in /usr/src/new/PORT/B/src/bsmall/B1fun.c line
196,
202
- in /usr/src/new/PORT/B/src/bsmall/B1num.c line
229
- in /usr/src/new/PORT/apl/src/ah.c line
83
- in /usr/src/new/PORT/apl/src/ao.c line
108,
213,
227,
236,
251,
277,
456,
493
- in /usr/src/new/PORT/apl/src/apl.h line
453
- in /usr/src/new/PORT/perl.1.0.0/arg.c line
1201,
1919
- in /usr/src/new/PORT/perl.1.0.0/perly.c line
1834,
2007
- in /usr/src/new/PORT/perl.1.0.10/arg.c line
1229,
1947
- in /usr/src/new/PORT/perl.1.0.10/perly.c line
1868,
2041
- in /usr/src/new/PORT/perl.1.0.16/arg.c line
1248,
1971
- in /usr/src/new/PORT/perl.1.0.16/perly.c line
1869,
2042
- in /usr/src/ucb/PORT/pascal/px/interp.c line
1650
- in /usr/src/ucb/PORT/systat/pigs.c line
219
- in /usr/src/ucb/pascal/px/00int.s line
8
- in /usr/src/ucb/pascal/px/34fun.s line
121
- in /usr/src/usr.lib/libF77/c_exp.c line
15-17(2)
- in /usr/src/usr.lib/libF77/d_exp.c line
12-13(2)
- in /usr/src/usr.lib/libF77/pow_zz.c line
15-20(2)
- in /usr/src/usr.lib/libF77/r_exp.c line
12-13(2)
- in /usr/src/usr.lib/libF77/z_exp.c line
15-17(2)
- in /usr/src/usr.lib/libom/erf.c line
99,
117
- in /usr/src/usr.lib/libom/pow.c line
10,
31-36(2)
- in /usr/src/usr.lib/libom/sinh.c line
17,
41,
49(2),
65-68(3)
Defined variables
errno
defined in line
13; used 1 times
log2e
defined in line
20; used 1 times
maxf
defined in line
22; used 2 times
p0
defined in line
14; used 1 times
p1
defined in line
15; used 1 times
p2
defined in line
16; used 1 times
q0
defined in line
17; used 1 times
q1
defined in line
18; used 1 times
q2
defined in line
19; used 1 times
sqrt2
defined in line
21; used 1 times