Commit 2b398912 by Richard Stallman

(atan2): For x <= 0, lump y == 0 with y > 0

to get the right result in 0, -1 case.

From-SVN: r4645
parent e1027c77
...@@ -155,19 +155,19 @@ atan2 (double y, double x) ...@@ -155,19 +155,19 @@ atan2 (double y, double x)
} }
else else
{ {
if (y > 0) if (y < 0)
{ {
if (-x > y) if (-x > -y)
return pi + atan (y / x); return - pi + atan (y / x);
else else
return pi_over_2 - atan (x / y); return - pi_over_2 - atan (x / y);
} }
else else
{ {
if (-x > -y) if (-x > y)
return - pi + atan (y / x); return pi + atan (y / x);
else if (y < 0) else if (y > 0)
return - pi_over_2 - atan (x / y); return pi_over_2 - atan (x / y);
else else
{ {
double value; double value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment