rust round 2 decimal places code example
Example: 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
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