diff --git a/listings/ch03-common-programming-concepts/no-listing-07-numeric-operations/src/main.rs b/listings/ch03-common-programming-concepts/no-listing-07-numeric-operations/src/main.rs index 9d3b4813bb..77c716c145 100644 --- a/listings/ch03-common-programming-concepts/no-listing-07-numeric-operations/src/main.rs +++ b/listings/ch03-common-programming-concepts/no-listing-07-numeric-operations/src/main.rs @@ -10,7 +10,7 @@ fn main() { // division let quotient = 56.7 / 32.2; - let floored = 2 / 3; // Results in 0 + let truncated = -5 / 3; // Results in -1 // remainder let remainder = 43 % 5; diff --git a/src/ch03-02-data-types.md b/src/ch03-02-data-types.md index 47c00adc8f..42e28819b6 100644 --- a/src/ch03-02-data-types.md +++ b/src/ch03-02-data-types.md @@ -147,9 +147,9 @@ Floating-point numbers are represented according to the IEEE-754 standard. The #### Numeric Operations -Rust supports the basic mathematical operations you’d expect for all of the -number types: addition, subtraction, multiplication, division, and remainder. -Integer division rounds down to the nearest integer. The following code shows +Rust supports the basic mathematical operations you’d expect for all the number +types: addition, subtraction, multiplication, division, and remainder. Integer +division truncates toward zero to the nearest integer. The following code shows how you’d use each numeric operation in a `let` statement: Filename: src/main.rs