Last active
July 21, 2023 05:33
-
-
Save matthewjberger/688a7a95aafac70939d074705c464518 to your computer and use it in GitHub Desktop.
Order of Operations example in rust
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let (a, b, c) = (1_i32, 2_i32, 3_f32); | |
let first_result = (a - b) as f32 / c * 1000.0; | |
let second_result = (a - b) as f32 / (c * 1000.0); | |
assert_eq!(first_result, second_result); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment