mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-23 13:01:42 -08:00
Revert "atan: fix if-clause order to work on signed zero"
This reverts commit 5199c6acd1.
This commit is contained in:
parent
17fc9b51b2
commit
7747313d74
1 changed files with 18 additions and 23 deletions
|
|
@ -22,17 +22,7 @@
|
|||
static double
|
||||
ecl_atan2_double(double y, double x)
|
||||
{
|
||||
if (x == 0) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI2_D;
|
||||
} else if (y == 0) {
|
||||
/* Signals floating-point-invalid-operation. If not trapped,
|
||||
produces NaN. */
|
||||
return x / y;
|
||||
} else {
|
||||
return ECL_PI2_D;
|
||||
}
|
||||
} else if (signbit(x)) {
|
||||
if (signbit(x)) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI_D + atan(-y / -x);
|
||||
} else if (y == 0) {
|
||||
|
|
@ -40,6 +30,14 @@ ecl_atan2_double(double y, double x)
|
|||
} else {
|
||||
return ECL_PI_D - atan(y / -x);
|
||||
}
|
||||
} else if (x == 0) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI2_D;
|
||||
} else if (y == 0) {
|
||||
return x / y; /* Produces a NaN */
|
||||
} else {
|
||||
return ECL_PI2_D;
|
||||
}
|
||||
} else {
|
||||
if (signbit(y)) {
|
||||
return -atan(-y / x);
|
||||
|
|
@ -55,18 +53,7 @@ ecl_atan2_double(double y, double x)
|
|||
static long double
|
||||
ecl_atan2_long_double(long double y, long double x)
|
||||
{
|
||||
if (x == 0) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI2_L;
|
||||
} else if (y == 0) {
|
||||
/* Signals floating-point-invalid-operation. If not trapped,
|
||||
produces NaN. */
|
||||
return x / y;
|
||||
} else {
|
||||
return ECL_PI2_L;
|
||||
}
|
||||
}
|
||||
else if (signbit(x)) {
|
||||
if (signbit(x)) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI_L + atanl(-y / -x);
|
||||
} else if (y == 0) {
|
||||
|
|
@ -74,6 +61,14 @@ ecl_atan2_long_double(long double y, long double x)
|
|||
} else {
|
||||
return ECL_PI_L - atanl(y / -x);
|
||||
}
|
||||
} else if (x == 0) {
|
||||
if (signbit(y)) {
|
||||
return -ECL_PI2_L;
|
||||
} else if (y == 0) {
|
||||
return x / y; /* Produces a NaN */
|
||||
} else {
|
||||
return ECL_PI2_L;
|
||||
}
|
||||
} else {
|
||||
if (signbit(y)) {
|
||||
return -atanl(-y / x);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue