const_soft_float/soft_f64/
copysign.rs

1use super::SoftF64;
2
3/// Sign of Y, magnitude of X (f64)
4///
5/// Constructs a number with the magnitude (absolute value) of its
6/// first argument, `x`, and the sign of its second argument, `y`.
7pub(crate) const fn copysign(x: SoftF64, y: SoftF64) -> SoftF64 {
8    let mut ux = x.to_bits();
9    let uy = y.to_bits();
10    ux &= (!0) >> 1;
11    ux |= uy & (1 << 63);
12    SoftF64::from_bits(ux)
13}