Answers for "rust round 2 decimal places"

0

rust round 2 decimal places

fn main() {
    let x = 12.34567_f64;
    let y = (x * 100.0).round() / 100.0;

    println!("{:.5} {:.5}", x, y);
}

// There is no built in method
Posted by: Guest on March-07-2021

Code answers related to "rust round 2 decimal places"

Browse Popular Code Answers by Language