some more fixes

This commit is contained in:
ceriel 1989-05-18 18:02:24 +00:00
parent e431cec90a
commit efe2c8d032
2 changed files with 15 additions and 8 deletions

View file

@ -40,7 +40,7 @@ asin_acos(x, cosfl)
x = -x; x = -x;
} }
if (x > 0.5) { if (x > 0.5) {
i = 1 - cosfl; i = 1;
if (x > 1) { if (x > 1) {
errno = EDOM; errno = EDOM;
return 0; return 0;
@ -51,16 +51,18 @@ asin_acos(x, cosfl)
} }
else { else {
/* ??? avoid underflow ??? */ /* ??? avoid underflow ??? */
i = 0;
g = x * x; g = x * x;
} }
x += x * g * POLYNOM4(g, p) / POLYNOM5(g, q); x += x * g * POLYNOM4(g, p) / POLYNOM5(g, q);
if (i == 1) { if (cosfl) {
if (cosfl == 0 || ! negative) { if (! negative) x = -x;
x = (x + M_PI_4) + M_PI_4; }
} if ((cosfl == 0) == (i == 1)) {
else if (cosfl && negative) { x = (x + M_PI_4) + M_PI_4;
x = (x + M_PI_2) + M_PI_2; }
} else if (cosfl && negative && i == 1) {
x = (x + M_PI_2) + M_PI_2;
} }
if (! cosfl && negative) x = -x; if (! cosfl && negative) x = -x;
return x; return x;

View file

@ -46,6 +46,7 @@ exp(x)
if (x > M_LN_MAX_D) errno = ERANGE; if (x > M_LN_MAX_D) errno = ERANGE;
return M_MAX_D; return M_MAX_D;
} }
if (negative) x = -x;
/* ??? avoid underflow ??? */ /* ??? avoid underflow ??? */
@ -57,6 +58,10 @@ exp(x)
g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4); g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
} }
if (negative) {
g = -g;
n = -n;
}
xn = g * g; xn = g * g;
x = g * POLYNOM2(xn, p); x = g * POLYNOM2(xn, p);
n += 1; n += 1;