INNER CODE UNIT · Go
xform
ericlagergren/decimal · big.go:679
xform := x.form // in case z == x
z.copyAbs(x)
z.form = xform ^ signbit
return z
}
// CopySign sets z to x with the sign of y and returns z.
//
// It accepts NaN values.
func (z *Big) CopySign(x, y *Big) *Big {
if debug {
x.validate()
y.validate()
}
// Pre-emptively capture signbit in case z == y.
sign := y.form & signbit
z.copyAbs(x)
z.form |= sign