3 * Base 10 exponential function
4 * (Common antilogarithm)
10 * float x, y, exp10f();
18 * Returns 10 raised to the x power.
20 * Range reduction is accomplished by expressing the argument
21 * as 10**x = 2**n 10**f, with |f| < 0.5 log10(2).
22 * A polynomial approximates 10**f.
29 * arithmetic domain # trials peak rms
30 * IEEE -38,+38 100000 9.8e-8 2.8e-8
34 * message condition value returned
35 * exp10 underflow x < -MAXL10 0.0
36 * exp10 overflow x > MAXL10 MAXNUM
38 * IEEE single arithmetic: MAXL10 = 38.230809449325611792.
43 Cephes Math Library Release 2.2: June, 1992
44 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
45 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
52 2.063216740311022E-001,
53 5.420251702225484E-001,
54 1.171292686296281E+000,
55 2.034649854009453E+000,
56 2.650948748208892E+000,
57 2.302585167056758E+000
60 /*static float LOG102 = 3.01029995663981195214e-1;*/
61 static float LOG210 = 3.32192809488736234787e0;
62 static float LG102A = 3.00781250000000000000E-1;
63 static float LG102B = 2.48745663981195213739E-4;
64 static float MAXL10 = 38.230809449325611792;
71 float floorf(float), ldexpf(float, int), polevlf(float, float *, int);
73 float exp10f(float xx)
81 mtherr( "exp10f", OVERFLOW );
85 if( x < -MAXL10 ) /* Would like to use MINLOG but can't */
87 mtherr( "exp10f", UNDERFLOW );
91 /* The following is necessary because range reduction blows up: */
95 /* Express 10**x = 10**g 2**n
96 * = 10**g 10**( n log10(2) )
97 * = 10**( g + n log10(2) )
100 qx = floorf( px + 0.5 );
105 /* rational approximation for exponential
106 * of the fractional part:
107 * 10**x - 1 = 2x P(x**2)/( Q(x**2) - P(x**2) )
109 px = 1.0 + x * polevlf( x, P, 5 );
111 /* multiply by power of 2 */