9 * float x, y, log10f();
17 * Returns logarithm to the base 10 of x.
19 * The argument is separated into its exponent and fractional
20 * parts. The logarithm of the fraction is approximated by
22 * log(1+x) = x - 0.5 x**2 + x**3 P(x).
29 * arithmetic domain # trials peak rms
30 * IEEE 0.5, 2.0 100000 1.3e-7 3.4e-8
31 * IEEE 0, MAXNUMF 100000 1.3e-7 2.6e-8
33 * In the tests over the interval [0, MAXNUM], the logarithms
34 * of the random arguments were uniformly distributed over
39 * log10f singularity: x = 0; returns -MAXL10
40 * log10f domain: x < 0; returns -MAXL10
41 * MAXL10 = 38.230809449325611792
45 Cephes Math Library Release 2.1: December, 1988
46 Copyright 1984, 1987, 1988 by Stephen L. Moshier
47 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
51 static char fname[] = {"log10"};
53 /* Coefficients for log(1+x) = x - x**2/2 + x**3 P(x)/Q(x)
54 * 1/sqrt(2) <= x < sqrt(2)
69 #define SQRTH 0.70710678118654752440
70 #define L102A 3.0078125E-1
71 #define L102B 2.48745663981195213739E-4
72 #define L10EA 4.3359375E-1
73 #define L10EB 7.00731903251827651129E-4
75 static float MAXL10 = 38.230809449325611792;
77 float frexpf(float, int *), polevlf(float, float *, int);
79 float log10f(float xx)
89 mtherr( fname, SING );
91 mtherr( fname, DOMAIN );
95 /* separate mantissa from exponent */
99 /* logarithm using log(1+x) = x - .5x**2 + x**3 P(x) */
114 y = x * ( z * polevlf( x, P, 8 ) );
115 y = y - 0.5 * z; /* y - 0.5 * x**2 */
117 /* multiply log of fraction by log10(e)
118 * and base 2 exponent by log10(2)
120 z = (x + y) * L10EB; /* accumulate terms in order of size */