Deleted Added
full compact
e_expf.c (218508) e_expf.c (226596)
1/* e_expf.c -- float version of e_exp.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
14 */
15
16#include <sys/cdefs.h>
1/* e_expf.c -- float version of e_exp.c.
2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
3 */
4
5/*
6 * ====================================================
7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
8 *
9 * Developed at SunPro, a Sun Microsystems, Inc. business.
10 * Permission to use, copy, modify, and distribute this
11 * software is freely granted, provided that this notice
12 * is preserved.
13 * ====================================================
14 */
15
16#include <sys/cdefs.h>
17__FBSDID("$FreeBSD: head/lib/msun/src/e_expf.c 218508 2011-02-10 07:37:29Z das $");
17__FBSDID("$FreeBSD: head/lib/msun/src/e_expf.c 226596 2011-10-21 06:26:38Z das $");
18
18
19#include <float.h>
20
19#include "math.h"
20#include "math_private.h"
21
22static const float
23one = 1.0,
24halF[2] = {0.5,-0.5,},
25huge = 1.0e+30,
26o_threshold= 8.8721679688e+01, /* 0x42b17180 */

--- 8 unchanged lines hidden (view full) ---

35 * |x*(exp(x)+1)/(exp(x)-1) - p(x)| < 2**-27.74
36 */
37P1 = 1.6666625440e-1, /* 0xaaaa8f.0p-26 */
38P2 = -2.7667332906e-3; /* -0xb55215.0p-32 */
39
40static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */
41
42float
21#include "math.h"
22#include "math_private.h"
23
24static const float
25one = 1.0,
26halF[2] = {0.5,-0.5,},
27huge = 1.0e+30,
28o_threshold= 8.8721679688e+01, /* 0x42b17180 */

--- 8 unchanged lines hidden (view full) ---

37 * |x*(exp(x)+1)/(exp(x)-1) - p(x)| < 2**-27.74
38 */
39P1 = 1.6666625440e-1, /* 0xaaaa8f.0p-26 */
40P2 = -2.7667332906e-3; /* -0xb55215.0p-32 */
41
42static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */
43
44float
43__ieee754_expf(float x) /* default IEEE double exp */
45__ieee754_expf(float x)
44{
45 float y,hi=0.0,lo=0.0,c,t,twopk;
46 int32_t k=0,xsb;
47 u_int32_t hx;
48
49 GET_FLOAT_WORD(hx,x);
50 xsb = (hx>>31)&1; /* sign bit of x */
51 hx &= 0x7fffffff; /* high word of |x| */

--- 13 unchanged lines hidden (view full) ---

65 if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */
66 hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
67 } else {
68 k = invln2*x+halF[xsb];
69 t = k;
70 hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
71 lo = t*ln2LO[0];
72 }
46{
47 float y,hi=0.0,lo=0.0,c,t,twopk;
48 int32_t k=0,xsb;
49 u_int32_t hx;
50
51 GET_FLOAT_WORD(hx,x);
52 xsb = (hx>>31)&1; /* sign bit of x */
53 hx &= 0x7fffffff; /* high word of |x| */

--- 13 unchanged lines hidden (view full) ---

67 if(hx < 0x3F851592) { /* and |x| < 1.5 ln2 */
68 hi = x-ln2HI[xsb]; lo=ln2LO[xsb]; k = 1-xsb-xsb;
69 } else {
70 k = invln2*x+halF[xsb];
71 t = k;
72 hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */
73 lo = t*ln2LO[0];
74 }
73 x = hi - lo;
75 STRICT_ASSIGN(float, x, hi - lo);
74 }
75 else if(hx < 0x39000000) { /* when |x|<2**-14 */
76 if(huge+x>one) return one+x;/* trigger inexact */
77 }
78 else k = 0;
79
80 /* x is now in primary range */
81 t = x*x;

--- 14 unchanged lines hidden ---
76 }
77 else if(hx < 0x39000000) { /* when |x|<2**-14 */
78 if(huge+x>one) return one+x;/* trigger inexact */
79 }
80 else k = 0;
81
82 /* x is now in primary range */
83 t = x*x;

--- 14 unchanged lines hidden ---