gitee.com/quant1x/num@v0.3.2/math32/abs.go (about) 1 package math32 2 3 // Abs returns the absolute value of x. 4 // 5 // Special cases are: 6 // 7 // Abs(±Inf) = +Inf 8 // Abs(NaN) = NaN 9 func Abs(x float32) float32 { 10 return Float32frombits(Float32bits(x) &^ (1 << 31)) 11 }