Instantly share code, notes, and snippets.

What would you like to do?
Code shared from the Rust Playground
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