mirror of
https://codeberg.org/unbeatable-101/FahrenheitToCelsius.git
synced 2024-06-18 23:07:12 +00:00
Changed five_div_nine to be a constant
This commit is contained in:
parent
df49c60121
commit
cb83fec39a
|
@ -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]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user