s_expm1.c (a00672cff92a23dd28a5e6a1f3a52189eb0d7d7a) | s_expm1.c (6d656800dbd7059985da943aebdecb2c2af52878) |
---|---|
1/* @(#)s_expm1.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice --- 31 unchanged lines hidden (view full) --- 40 * maximum error of this polynomial approximation is bounded 41 * by 2**-61. In other words, 42 * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 43 * where Q1 = -1.6666666666666567384E-2, 44 * Q2 = 3.9682539681370365873E-4, 45 * Q3 = -9.9206344733435987357E-6, 46 * Q4 = 2.5051361420808517002E-7, 47 * Q5 = -6.2843505682382617102E-9; | 1/* @(#)s_expm1.c 5.1 93/09/24 */ 2/* 3 * ==================================================== 4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. 5 * 6 * Developed at SunPro, a Sun Microsystems, Inc. business. 7 * Permission to use, copy, modify, and distribute this 8 * software is freely granted, provided that this notice --- 31 unchanged lines hidden (view full) --- 40 * maximum error of this polynomial approximation is bounded 41 * by 2**-61. In other words, 42 * R1(z) ~ 1.0 + Q1*z + Q2*z**2 + Q3*z**3 + Q4*z**4 + Q5*z**5 43 * where Q1 = -1.6666666666666567384E-2, 44 * Q2 = 3.9682539681370365873E-4, 45 * Q3 = -9.9206344733435987357E-6, 46 * Q4 = 2.5051361420808517002E-7, 47 * Q5 = -6.2843505682382617102E-9; |
48 * (where z=r*r, and the values of Q1 to Q5 are listed below) | 48 * z = r*r, |
49 * with error bounded by 50 * | 5 | -61 51 * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 52 * | | 53 * 54 * expm1(r) = exp(r)-1 is then computed by the following 55 * specific way which minimize the accumulation rounding error: 56 * 2 3 --- 57 unchanged lines hidden (view full) --- 114static const double 115one = 1.0, 116huge = 1.0e+300, 117tiny = 1.0e-300, 118o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ 119ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ 120ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ 121invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ | 49 * with error bounded by 50 * | 5 | -61 51 * | 1.0+Q1*z+...+Q5*z - R1(z) | <= 2 52 * | | 53 * 54 * expm1(r) = exp(r)-1 is then computed by the following 55 * specific way which minimize the accumulation rounding error: 56 * 2 3 --- 57 unchanged lines hidden (view full) --- 114static const double 115one = 1.0, 116huge = 1.0e+300, 117tiny = 1.0e-300, 118o_threshold = 7.09782712893383973096e+02,/* 0x40862E42, 0xFEFA39EF */ 119ln2_hi = 6.93147180369123816490e-01,/* 0x3fe62e42, 0xfee00000 */ 120ln2_lo = 1.90821492927058770002e-10,/* 0x3dea39ef, 0x35793c76 */ 121invln2 = 1.44269504088896338700e+00,/* 0x3ff71547, 0x652b82fe */ |
122 /* scaled coefficients related to expm1 */ | 122/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */ |
123Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */ 124Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ 125Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ 126Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ 127Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ 128 129double 130expm1(double x) --- 85 unchanged lines hidden --- | 123Q1 = -3.33333333333331316428e-02, /* BFA11111 111110F4 */ 124Q2 = 1.58730158725481460165e-03, /* 3F5A01A0 19FE5585 */ 125Q3 = -7.93650757867487942473e-05, /* BF14CE19 9EAADBB7 */ 126Q4 = 4.00821782732936239552e-06, /* 3ED0CFCA 86E65239 */ 127Q5 = -2.01099218183624371326e-07; /* BE8AFDB7 6E09C32D */ 128 129double 130expm1(double x) --- 85 unchanged lines hidden --- |