Skip to main content

int

Function int 

Source
pub fn int<I, F>(x: F) -> Option<I>
where I: Int, F: Float,
Expand description

x, a whole float, as an integer of type I. None where x is NaN or infinite, or lies outside I. For i64 and u32, a magnitude beyond 2^51 - 1 also gives None, and so does i32::MIN from an f32. A fraction gives an integer next to it, or None.