xyosc/vendor/github.com/chewxy/math32/copysign.go

9 lines
176 B
Go
Raw Normal View History

2024-12-21 17:38:26 +01:00
package math32
import "math"
func Copysign(x, y float32) float32 {
const sign = 1 << 31
return math.Float32frombits(math.Float32bits(x)&^sign | math.Float32bits(y)&sign)
}