Created
May 16, 2018 18:12
-
-
Save rust-play/fade3507a34fceabaf57261e228d76b4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
This file contains 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
#[test] | |
fn floor_negative() { | |
// With parentheses around the number, this works. | |
assert_eq!((-1.01f64).floor(), -2.0); | |
// Without parentheses, the meaning is "the negation of `1.01f64.floor()`" | |
// which gives a different answer. | |
assert_eq!(-1.01f64.floor(), -1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment