2020-05-09 14:48:39 +00:00
|
|
|
package tins2020
|
|
|
|
|
|
|
|
import "math"
|
|
|
|
|
2020-05-09 17:34:43 +00:00
|
|
|
func Abs32(x float32) float32 {
|
|
|
|
if x < 0 {
|
|
|
|
return -x
|
|
|
|
}
|
|
|
|
return x
|
|
|
|
}
|
|
|
|
|
|
|
|
func AbsSub32(a, b float32) float32 {
|
|
|
|
if a > b {
|
|
|
|
return a - b
|
|
|
|
}
|
|
|
|
return b - a
|
|
|
|
}
|
|
|
|
|
2020-05-09 14:48:39 +00:00
|
|
|
func Ceil32(x float32) float32 { return float32(math.Ceil(float64(x))) }
|
|
|
|
|
|
|
|
func Floor32(x float32) float32 { return float32(math.Floor(float64(x))) }
|
2020-05-09 17:34:43 +00:00
|
|
|
|
|
|
|
func Max32(a, b float32) float32 {
|
|
|
|
if a > b {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
|
|
|
func Min32(a, b float32) float32 {
|
|
|
|
if a < b {
|
|
|
|
return a
|
|
|
|
}
|
|
|
|
return b
|
|
|
|
}
|
|
|
|
|
2020-05-09 22:19:44 +00:00
|
|
|
func Round32(x float32) float32 { return float32(math.Round(float64(x))) }
|
|
|
|
|
2020-05-09 17:34:43 +00:00
|
|
|
func Sqrt32(x float32) float32 { return float32(math.Sqrt(float64(x))) }
|