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