Skip to content

Commit 46cb953

Browse files
authored
Fixed #21 (#22)
1 parent 42ad53f commit 46cb953

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

atan2.go

+21-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,25 @@ package math32
22

33
import "math"
44

5-
func Atan2(x, y float32) float32 {
6-
return float32(math.Atan2(float64(x), float64(y)))
5+
// Atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.
6+
// Special cases are (in order):
7+
// Atan2(y, NaN) = NaN
8+
// Atan2(NaN, x) = NaN
9+
// Atan2(+0, x>=0) = +0
10+
// Atan2(-0, x>=0) = -0
11+
// Atan2(+0, x<=-0) = +Pi
12+
// Atan2(-0, x<=-0) = -Pi
13+
// Atan2(y>0, 0) = +Pi/2
14+
// Atan2(y<0, 0) = -Pi/2
15+
// Atan2(+Inf, +Inf) = +Pi/4
16+
// Atan2(-Inf, +Inf) = -Pi/4
17+
// Atan2(+Inf, -Inf) = 3Pi/4
18+
// Atan2(-Inf, -Inf) = -3Pi/4
19+
// Atan2(y, +Inf) = 0
20+
// Atan2(y>0, -Inf) = +Pi
21+
// Atan2(y<0, -Inf) = -Pi
22+
// Atan2(+Inf, x) = +Pi/2
23+
// Atan2(-Inf, x) = -Pi/2
24+
func Atan2(y, x float32) float32 {
25+
return float32(math.Atan2(float64(y), float64(x)))
726
}

0 commit comments

Comments
 (0)