3 @@ -4399,3 +4399,146 @@ ipmi_sdr_main(struct ipmi_intf *intf, in
16 + * double x, y, cbrt();
24 + * Returns the cube root of the argument, which may be negative.
26 + * Range reduction involves determining the power of 2 of
27 + * the argument. A polynomial of degree 2 applied to the
28 + * mantissa, and multiplication by the cube root of 1, 2, or 4
29 + * approximates the root to within about 0.1%. Then Newton's
30 + * iteration is used three times to converge to an accurate
38 + * arithmetic domain # trials peak rms
39 + * DEC -10,10 200000 1.8e-17 6.2e-18
40 + * IEEE 0,1e308 30000 1.5e-16 5.0e-17
46 +Cephes Math Library Release 2.8: June, 2000
47 +Copyright 1984, 1991, 2000 by Stephen L. Moshier
51 +static double CBRT2 = 1.2599210498948731647672;
52 +static double CBRT4 = 1.5874010519681994747517;
53 +static double CBRT2I = 0.79370052598409973737585;
54 +static double CBRT4I = 0.62996052494743658238361;
57 +extern double frexp ( double, int * );
58 +extern double ldexp ( double, int );
59 +extern int isnan ( double );
60 +extern int isfinite ( double );
63 +double frexp(), ldexp();
64 +int isnan(double), isfinite(double);
68 +double cbrt(double x)
93 +/* extract power of 2, leaving
94 + * mantissa between 0.5 and 1
98 +/* Approximate cube root of number between .5 and 1,
99 + * peak relative error = 9.2e-6
101 +x = (((-1.3466110473359520655053e-1 * x
102 + + 5.4664601366395524503440e-1) * x
103 + - 9.5438224771509446525043e-1) * x
104 + + 1.1399983354717293273738e0 ) * x
105 + + 4.0238979564544752126924e-1;
107 +/* exponent divided by 3 */
115 + else if( rem == 2 )
120 +/* argument less than 1 */
130 + else if( rem == 2 )
135 +/* multiply by power of 2 */
138 +/* Newton iteration */
139 +x -= ( x - (z/(x*x)) )*0.33333333333333333333;
141 +x -= ( x - (z/(x*x)) )/3.0;
143 +x -= ( x - (z/(x*x)) )*0.33333333333333333333;