2 * (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 * Author: Ceriel J.H. Jacobs
12 #include "localmath.h"
18 /* Algorithm and coefficients from:
19 "Software manual for the elementary functions"
20 by W.J. Cody and W. Waite, Prentice-Hall, 1980
24 0.25000000000000000000e+0,
25 0.75753180159422776666e-2,
26 0.31555192765684646356e-4
30 0.50000000000000000000e+0,
31 0.56817302698551221787e-1,
32 0.63121894374398503557e-3,
33 0.75104028399870046114e-6
54 /* ??? avoid underflow ??? */
56 n
= x
* M_LOG2E
+ 0.5; /* 1/ln(2) = log2(e), 0.5 added for rounding */
62 g
= ((x1
-xn
*0.693359375)+x2
) - xn
*(-2.1219444005469058277e-4);
69 x
= g
* POLYNOM2(xn
, p
);
71 return (ldexp(0.5 + x
/(POLYNOM3(xn
, q
) - x
), n
));