fn round_to_even(f: f64) -> u64 {
        assert!(0.0 <= f);
        let cast = f as u64;
        let diff = f - cast as f64;
        if diff == 0.5 {
            if cast % 2 == 0 {
                cast
            } else {
                cast + 1
            }
        } else if diff < 0.5 {
            cast
        } else {
            cast + 1
        }
    }
/// If a fraction is less than 0.5, it is rounded down.
/// if a fraction is greater than 0.5, it is rounded up.
/// if a fraction is just 0.5, round down or round up,
/// whichever results in an even number.
If a fraction is less than 0.5, it is rounded down.
if a fraction is greater than 0.5, it is rounded up.
if a fraction is just 0.5, round down or round up,
whichever results in an even number.
If a fraction is less than 0 . 5 it is rounded down . if a fraction is greater than 0 . 5 it is rounded up . if a fraction is just 0 . 5 round down or round up whichever results in an even number .
fn round_to_even(f: f64) -> u64 {
        assert!(0.0 <= f);
        let cast = f as u64;
        let diff = f - cast as f64;
        if diff == 0.5 {
            if cast % 2 == 0 {
                cast
            } else {
                cast + 1
            }
        } else if diff < 0.5 {
            cast
        } else {
            cast + 1
        }
    }
fn round_to_even ( f : f64 ) -> u64 { assert ! ( 0.0 f ) ; let cast = f as u64 ; let diff = f - cast as f64 ; if diff == 0.5 { if cast % 2 == 0 { cast } else { cast + 1 } } else if diff < 0.5 { cast } else { cast + 1 } }
If a fraction is less than 0.5, it is rounded down.
If a fraction is less than 0 . 5 it is rounded down .
f
f64
f
f64