Coverage Report

Created: 2025-07-12 07:16

/rust/registry/src/index.crates.io-6f17d22bba15001f/libm-0.2.11/src/math/scalbnf.rs
Line
Count
Source (jump to first uncovered line)
1
#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)]
2
0
pub fn scalbnf(mut x: f32, mut n: i32) -> f32 {
3
0
    let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127
4
0
    let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126
5
0
    let x1p24 = f32::from_bits(0x4b800000); // 0x1p24f === 2 ^ 24
6
0
7
0
    if n > 127 {
8
0
        x *= x1p127;
9
0
        n -= 127;
10
0
        if n > 127 {
11
0
            x *= x1p127;
12
0
            n -= 127;
13
0
            if n > 127 {
14
0
                n = 127;
15
0
            }
16
0
        }
17
0
    } else if n < -126 {
18
0
        x *= x1p_126 * x1p24;
19
0
        n += 126 - 24;
20
0
        if n < -126 {
21
0
            x *= x1p_126 * x1p24;
22
0
            n += 126 - 24;
23
0
            if n < -126 {
24
0
                n = -126;
25
0
            }
26
0
        }
27
0
    }
28
0
    x * f32::from_bits(((0x7f + n) as u32) << 23)
29
0
}