56 lines
821 B
Go
56 lines
821 B
Go
package tins2020
|
|
|
|
import "math"
|
|
|
|
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
|
|
}
|
|
|
|
func Ceil32(x float32) float32 { return float32(math.Ceil(float64(x))) }
|
|
|
|
func Floor32(x float32) float32 { return float32(math.Floor(float64(x))) }
|
|
|
|
func Max(a, b int32) int32 {
|
|
if a > b {
|
|
return a
|
|
}
|
|
return b
|
|
}
|
|
|
|
func Max32(a, b float32) float32 {
|
|
if a > b {
|
|
return a
|
|
}
|
|
return b
|
|
}
|
|
|
|
func Min(a, b int32) int32 {
|
|
if a < b {
|
|
return a
|
|
}
|
|
return b
|
|
}
|
|
|
|
func Min32(a, b float32) float32 {
|
|
if a < b {
|
|
return a
|
|
}
|
|
return b
|
|
}
|
|
|
|
func Round32(x float32) float32 { return float32(math.Round(float64(x))) }
|
|
|
|
func Sqr32(x float32) float32 { return x * x }
|
|
|
|
func Sqrt32(x float32) float32 { return float32(math.Sqrt(float64(x))) }
|