File: abs.go

package info (click to toggle)
golang-github-chewxy-math32 1.11.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 460 kB
  • sloc: asm: 388; makefile: 4
file content (10 lines) | stat: -rw-r--r-- 205 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
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))
}