diff --git a/src/math/abs.go b/src/math/abs.go
index 08be145..945cbd5 100644
--- a/src/math/abs.go
+++ b/src/math/abs.go
@@ -11,5 +11,5 @@
// Abs(±Inf) = +Inf
// Abs(NaN) = NaN
func Abs(x float64) float64 {
- return Float64frombits(Float64bits(x) &^ (1 << 63))
+ return Float64frombits(Float64bits(x) &^ signMask)
}
diff --git a/src/math/copysign.go b/src/math/copysign.go
index 3a30afb..ae9ae35 100644
--- a/src/math/copysign.go
+++ b/src/math/copysign.go
@@ -7,6 +7,5 @@
// Copysign returns a value with the magnitude of f
// and the sign of sign.
func Copysign(f, sign float64) float64 {
- const signBit = 1 << 63
- return Float64frombits(Float64bits(f)&^signBit | Float64bits(sign)&signBit)
+ return Float64frombits(Float64bits(f)&^signMask | Float64bits(sign)&signMask)
}