ATAN now provides a better approximation to PI/2 when working with long doubles

This commit is contained in:
Juan Jose Garcia Ripoll 2009-06-14 23:32:46 +02:00
parent 2acd731e9e
commit cf1aa3dfc3

View file

@ -429,19 +429,19 @@ ecl_atan2_long_double(long double y, long double x)
{
if (signbit(x)) {
if (signbit(y)) {
return -ECL_PI_D + atanl(-y / -x);
return -ECL_PI_L + atanl(-y / -x);
} else if (y == 0) {
return ECL_PI_D;
return ECL_PI_L;
} else {
return ECL_PI_D - atanl(y / -x);
return ECL_PI_L - atanl(y / -x);
}
} else if (x == 0) {
if (signbit(y)) {
return -ECL_PI2_D;
return -ECL_PI2_L;
} else if (y == 0) {
return x / y; /* Produces a NaN */
} else {
return ECL_PI2_D;
return ECL_PI2_L;
}
} else {
if (signbit(y)) {