How To Convert Int To Float In Rust

[Solved] How To Convert Int To Float In Rust | Haskell - Code Explorer | yomemimo.com
Question : how to add integer and float in rust

Answered by : bijay-poudel

fn main(){ let x:f32=20.0; let y:i32=10; let sum = x + y as f32; println!("{}",sum);
}

Source : | Last Update : Mon, 06 Sep 21

Question : rust float to int

Answered by : florin-relea

let new_calories: u16 = (food.calories.clone() as f64 * quantity) as u16;

Source : | Last Update : Wed, 02 Nov 22

Answers related to how to convert int to float in rust

Code Explorer Popular Question For Haskell