Coverage Report

Created: 2024-11-19 11:03

/build/cargo-vendor-dir/libm-0.2.8/src/math/modff.rs
Line
Count
Source (jump to first uncovered line)
1
0
pub fn modff(x: f32) -> (f32, f32) {
2
0
    let rv2: f32;
3
0
    let mut u: u32 = x.to_bits();
4
0
    let mask: u32;
5
0
    let e = ((u >> 23 & 0xff) as i32) - 0x7f;
6
0
7
0
    /* no fractional part */
8
0
    if e >= 23 {
9
0
        rv2 = x;
10
0
        if e == 0x80 && (u << 9) != 0 {
11
            /* nan */
12
0
            return (x, rv2);
13
0
        }
14
0
        u &= 0x80000000;
15
0
        return (f32::from_bits(u), rv2);
16
0
    }
17
0
    /* no integral part */
18
0
    if e < 0 {
19
0
        u &= 0x80000000;
20
0
        rv2 = f32::from_bits(u);
21
0
        return (x, rv2);
22
0
    }
23
0
24
0
    mask = 0x007fffff >> e;
25
0
    if (u & mask) == 0 {
26
0
        rv2 = x;
27
0
        u &= 0x80000000;
28
0
        return (f32::from_bits(u), rv2);
29
0
    }
30
0
    u &= !mask;
31
0
    rv2 = f32::from_bits(u);
32
0
    return (x - rv2, rv2);
33
0
}