/rust/registry/src/index.crates.io-6f17d22bba15001f/libm-0.2.11/src/math/copysignf.rs
Line | Count | Source (jump to first uncovered line) |
1 | | /// Sign of Y, magnitude of X (f32) |
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)] |
6 | 0 | pub fn copysignf(x: f32, y: f32) -> f32 { |
7 | 0 | let mut ux = x.to_bits(); |
8 | 0 | let uy = y.to_bits(); |
9 | 0 | ux &= 0x7fffffff; |
10 | 0 | ux |= uy & 0x80000000; |
11 | 0 | f32::from_bits(ux) |
12 | 0 | } |