mirror of
https://github.com/make-42/xyosc
synced 2025-01-18 18:57:10 +01:00
11 lines
205 B
Go
11 lines
205 B
Go
package math32
|
|
|
|
// Abs returns the absolute value of x.
|
|
//
|
|
// Special cases are:
|
|
// Abs(±Inf) = +Inf
|
|
// Abs(NaN) = NaN
|
|
func Abs(x float32) float32 {
|
|
return Float32frombits(Float32bits(x) &^ (1 << 31))
|
|
}
|