54 lines
1.0 KiB
Go
54 lines
1.0 KiB
Go
package geom
|
|
|
|
import "math"
|
|
|
|
// Abs returns the absolute value.
|
|
func Abs(f float64) float64 {
|
|
return math.Abs(f)
|
|
}
|
|
|
|
// Abs32 returns the absolute value.
|
|
func Abs32(f float32) float32 {
|
|
return float32(Abs(float64(f)))
|
|
}
|
|
|
|
// IsNaN checks if the floating point number is not a number.
|
|
func IsNaN(f float64) bool {
|
|
return f != f
|
|
}
|
|
|
|
// IsNaN32 checks if the floating point number is not a number.
|
|
func IsNaN32(f float32) bool {
|
|
return f != f
|
|
}
|
|
|
|
// NaN returns not a floating point number.
|
|
func NaN() float64 {
|
|
return math.NaN()
|
|
}
|
|
|
|
// NaN32 returns not a floating point number.
|
|
func NaN32() float32 {
|
|
return float32(NaN())
|
|
}
|
|
|
|
// Max the maximum of the two values.
|
|
func Max(a, b float64) float64 {
|
|
return math.Max(a, b)
|
|
}
|
|
|
|
// Max32 the maximum of the two values.
|
|
func Max32(a, b float32) float32 {
|
|
return float32(math.Max(float64(a), float64(b)))
|
|
}
|
|
|
|
// Min the minimum of the two values.
|
|
func Min(a, b float64) float64 {
|
|
return math.Min(a, b)
|
|
}
|
|
|
|
// Min32 the minimum of the two values.
|
|
func Min32(a, b float32) float32 {
|
|
return float32(math.Min(float64(a), float64(b)))
|
|
}
|