|
|
DataMuseum.dkPresents historical artifacts from the history of: Commodore CBM-900 |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Commodore CBM-900 Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - download
Length: 666 (0x29a)
Types: TextFile
Notes: UNIX file
Names: »two.c«
└─⟦f27320a65⟧ Bits:30001972 Commodore 900 hard disk image with partial source code
└─⟦f4b8d8c84⟧ UNIX Filesystem
└─⟦this⟧ »libm/two.c«
/*
* Evaluate 2 to the power x.
* (Hart 1067, 18.08)
*/
#include <math.h>
static double twontab[] ={
0.1513906799054338915894328e+04,
0.2020206565128692722788600e+02,
0.2309334775375023362400000e-01
};
static double twomtab[] ={
0.4368211662727558498496814e+04,
0.2331842114274816237902950e+03,
0.1000000000000000000000000e+01
};
double
_two(x)
double x;
{
double p, q, r, e;
register int s;
if (x > L2I) {
errno = ERANGE;
return (I);
}
s = 0;
x = modf(x, &e);
if (x > 0.5) {
s = 1;
x -= 0.5;
}
r = x*x;
p = x*_pol(r, twontab, 3);
q = _pol(r, twomtab, 3);
r = (q+p)/(q-p);
if (s)
r *= SQRT2;
r = ldexp(r, (int) e);
return (r);
}