]> Cypherpunks repositories - gostls13.git/commitdiff
math: fix argument names in Atan2
authorRuss Cox <rsc@golang.org>
Tue, 17 Nov 2009 16:39:56 +0000 (08:39 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 17 Nov 2009 16:39:56 +0000 (08:39 -0800)
(error introduced converting from arg1, arg2)

Fixes #220.

R=r
https://golang.org/cl/156041

src/pkg/math/atan2.go

index 7165c539eeda801a77a0cfaa52d926db52a2ae82..26d3a1d682779b593557f815f8da7cc24a03f90c 100644 (file)
@@ -4,20 +4,19 @@
 
 package math
 
-
-// Atan returns the arc tangent of y/x, using
+// Atan2 returns the arc tangent of y/x, using
 // the signs of the two to determine the quadrant
 // of the return value.
-func Atan2(x, y float64) float64 {
+func Atan2(y, x float64) float64 {
        // Determine the quadrant and call atan.
-       if x+y == x {
-               if x >= 0 {
+       if y+x == y {
+               if y >= 0 {
                        return Pi / 2
                }
                return -Pi / 2;
        }
-       q := Atan(x / y);
-       if y < 0 {
+       q := Atan(y / x);
+       if x < 0 {
                if q <= 0 {
                        return q + Pi
                }