1984-11-29 14:22:02 +00:00
|
|
|
/*
|
1988-07-25 11:13:26 +00:00
|
|
|
* (c) copyright 1988 by the Vrije Universiteit, Amsterdam, The Netherlands.
|
|
|
|
* See the copyright notice in the ACK home directory, in the file "Copyright".
|
1984-11-29 14:22:02 +00:00
|
|
|
*
|
1988-07-25 11:13:26 +00:00
|
|
|
* Author: Ceriel J.H. Jacobs
|
1984-11-29 14:22:02 +00:00
|
|
|
*/
|
|
|
|
|
1985-01-21 12:47:04 +00:00
|
|
|
/* $Header$ */
|
1984-11-29 14:22:02 +00:00
|
|
|
|
1988-07-25 11:40:57 +00:00
|
|
|
#define __NO_DEFS
|
1988-07-25 11:13:26 +00:00
|
|
|
#include <math.h>
|
1984-11-29 14:22:02 +00:00
|
|
|
|
|
|
|
double
|
1988-07-25 11:13:26 +00:00
|
|
|
_log(x)
|
|
|
|
double x;
|
1984-11-29 14:22:02 +00:00
|
|
|
{
|
1988-07-25 11:13:26 +00:00
|
|
|
/* log(x) = z*P(z*z)/Q(z*z), z = (x-1)/(x+1), x in [1/sqrt(2), sqrt(2)]
|
1984-11-29 14:22:02 +00:00
|
|
|
*/
|
1988-07-25 11:13:26 +00:00
|
|
|
/* Hart & Cheney #2707 */
|
|
|
|
|
|
|
|
static double p[5] = {
|
|
|
|
0.7504094990777122217455611007e+02,
|
|
|
|
-0.1345669115050430235318253537e+03,
|
|
|
|
0.7413719213248602512779336470e+02,
|
|
|
|
-0.1277249755012330819984385000e+02,
|
|
|
|
0.3327108381087686938144000000e+00
|
|
|
|
};
|
|
|
|
|
|
|
|
static double q[5] = {
|
|
|
|
0.3752047495388561108727775374e+02,
|
|
|
|
-0.7979028073715004879439951583e+02,
|
|
|
|
0.5616126132118257292058560360e+02,
|
|
|
|
-0.1450868091858082685362325000e+02,
|
|
|
|
0.1000000000000000000000000000e+01
|
|
|
|
};
|
|
|
|
|
|
|
|
extern double _fef();
|
|
|
|
double z, zsqr;
|
|
|
|
int exponent;
|
|
|
|
|
|
|
|
if (x <= 0) {
|
|
|
|
error(3);
|
|
|
|
return -HUGE;
|
1984-11-29 14:22:02 +00:00
|
|
|
}
|
|
|
|
|
1988-07-25 11:13:26 +00:00
|
|
|
x = _fef(x, &exponent);
|
|
|
|
while (x < M_1_SQRT2) {
|
|
|
|
x += x;
|
|
|
|
exponent--;
|
|
|
|
}
|
1984-11-29 14:22:02 +00:00
|
|
|
z = (x-1)/(x+1);
|
1988-07-25 11:13:26 +00:00
|
|
|
zsqr = z*z;
|
|
|
|
return z * POLYNOM4(zsqr, p) / POLYNOM4(zsqr, q) + exponent * M_LN2;
|
1984-11-29 14:22:02 +00:00
|
|
|
}
|