...
Source file src/pkg/math/asin.go
1
2
3
4
5 package math
6
7
13
14
15
16
17
18
19 func Asin(x float64) float64
20
21 func asin(x float64) float64 {
22 if x == 0 {
23 return x
24 }
25 sign := false
26 if x < 0 {
27 x = -x
28 sign = true
29 }
30 if x > 1 {
31 return NaN()
32 }
33
34 temp := Sqrt(1 - x*x)
35 if x > 0.7 {
36 temp = Pi/2 - satan(temp/x)
37 } else {
38 temp = satan(x / temp)
39 }
40
41 if sign {
42 temp = -temp
43 }
44 return temp
45 }
46
47
48
49
50
51 func Acos(x float64) float64
52
53 func acos(x float64) float64 {
54 return Pi/2 - Asin(x)
55 }
56
View as plain text