1 /// Sign of Y, magnitude of X (f64) 2 /// 3 /// Constructs a number with the magnitude (absolute value) of its 4 /// first argument, `x`, and the sign of its second argument, `y`. 5 #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] copysign(x: f64, y: f64) -> f646pub fn copysign(x: f64, y: f64) -> f64 { 7 let mut ux = x.to_bits(); 8 let uy = y.to_bits(); 9 ux &= (!0) >> 1; 10 ux |= uy & (1 << 63); 11 f64::from_bits(ux) 12 } 13