Skip to content

Commit

Permalink
Fixed #21 (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
chewxy committed Jul 1, 2021
1 parent 42ad53f commit 46cb953
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions atan2.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@ package math32

import "math"

func Atan2(x, y float32) float32 {
return float32(math.Atan2(float64(x), float64(y)))
// Atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.
// Special cases are (in order):
// Atan2(y, NaN) = NaN
// Atan2(NaN, x) = NaN
// Atan2(+0, x>=0) = +0
// Atan2(-0, x>=0) = -0
// Atan2(+0, x<=-0) = +Pi
// Atan2(-0, x<=-0) = -Pi
// Atan2(y>0, 0) = +Pi/2
// Atan2(y<0, 0) = -Pi/2
// Atan2(+Inf, +Inf) = +Pi/4
// Atan2(-Inf, +Inf) = -Pi/4
// Atan2(+Inf, -Inf) = 3Pi/4
// Atan2(-Inf, -Inf) = -3Pi/4
// Atan2(y, +Inf) = 0
// Atan2(y>0, -Inf) = +Pi
// Atan2(y<0, -Inf) = -Pi
// Atan2(+Inf, x) = +Pi/2
// Atan2(-Inf, x) = -Pi/2
func Atan2(y, x float32) float32 {
return float32(math.Atan2(float64(y), float64(x)))
}

0 comments on commit 46cb953

Please sign in to comment.