1
0
mirror of https://github.com/golang/go synced 2024-09-25 01:20:13 -06:00

math: fix argument names in Atan2

(error introduced converting from arg1, arg2)

Fixes #220.

R=r
https://golang.org/cl/156041
This commit is contained in:
Russ Cox 2009-11-17 08:39:56 -08:00
parent c0e1ccf3ff
commit b4586a7429

View File

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