Changed five_div_nine to be a constant

This commit is contained in:
William Davis 2024-01-03 00:33:37 -05:00
parent df49c60121
commit cb83fec39a
No known key found for this signature in database
2 changed files with 3 additions and 7 deletions

View File

@ -1,8 +1,4 @@
[package]
name = "ftoc"
version = "1.0.1"
version = "1.0.2"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@ -2,8 +2,8 @@ use std::io;
fn convert(temp: f64) -> f64 {
let mut celsius = temp - 32_f64;
let five_div_nine = 5.0 / 9.0;
celsius *= five_div_nine;
const FIVE_DIV_NINE: f64 = 5.0 / 9.0;
celsius *= FIVE_DIV_NINE;
return celsius;
}