x = -x;
}
if (x > 0.5) {
- i = 1 - cosfl;
+ i = 1;
if (x > 1) {
errno = EDOM;
return 0;
}
else {
/* ??? avoid underflow ??? */
+ i = 0;
g = x * x;
}
x += x * g * POLYNOM4(g, p) / POLYNOM5(g, q);
- if (i == 1) {
- if (cosfl == 0 || ! negative) {
- x = (x + M_PI_4) + M_PI_4;
- }
- else if (cosfl && negative) {
- x = (x + M_PI_2) + M_PI_2;
- }
+ if (cosfl) {
+ if (! negative) x = -x;
+ }
+ if ((cosfl == 0) == (i == 1)) {
+ x = (x + M_PI_4) + M_PI_4;
+ }
+ else if (cosfl && negative && i == 1) {
+ x = (x + M_PI_2) + M_PI_2;
}
if (! cosfl && negative) x = -x;
return x;
if (x > M_LN_MAX_D) errno = ERANGE;
return M_MAX_D;
}
+ if (negative) x = -x;
/* ??? avoid underflow ??? */
g = ((x1-xn*0.693359375)+x2) - xn*(-2.1219444005469058277e-4);
}
+ if (negative) {
+ g = -g;
+ n = -n;
+ }
xn = g * g;
x = g * POLYNOM2(xn, p);
n += 1;