Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created May 16, 2018 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/fade3507a34fceabaf57261e228d76b4 to your computer and use it in GitHub Desktop.
Save rust-play/fade3507a34fceabaf57261e228d76b4 to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
#[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