-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.go
65 lines (49 loc) · 1.23 KB
/
math.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package math
import (
nativeMath "math"
)
const (
Pi = float32(nativeMath.Pi)
)
func Abs(v float32) float32 {
return float32(nativeMath.Abs(float64(v)))
}
func Sqrt(v float32) float32 {
return float32(nativeMath.Sqrt(float64(v)))
}
func Cos(x float32) float32 {
return float32(nativeMath.Cos(float64(x)))
}
func Sin(x float32) float32 {
return float32(nativeMath.Sin(float64(x)))
}
func Asin(x float32) float32 {
return float32(nativeMath.Asin(float64(x)))
}
func Acos(x float32) float32 {
return float32(nativeMath.Acos(float64(x)))
}
func Atan2(y, x float32) float32 {
return float32(nativeMath.Atan2(float64(y), float64(x)))
}
func Max(y, x float32) float32 {
return float32(nativeMath.Max(float64(y), float64(x)))
}
func Min(y, x float32) float32 {
return float32(nativeMath.Min(float64(y), float64(x)))
}
func Round(x float32) float32 {
return float32(nativeMath.Round(float64(x)))
}
func Pow(x, y float32) float32 {
return float32(nativeMath.Pow(float64(x), float64(y)))
}
func Floor(x float32) float32 {
return float32(nativeMath.Floor(float64(x)))
}
func Ceil(x float32) float32 {
return float32(nativeMath.Ceil(float64(x)))
}
func Clamp(value float32, min float32, max float32) float32 {
return Max(min, Min(max, value))
}