diff options
| author | Christian <chris_veenman@hotmail.com> | 2019-04-01 22:49:14 +0200 |
|---|---|---|
| committer | Christian <chris_veenman@hotmail.com> | 2019-04-01 22:49:14 +0200 |
| commit | a1c79056e5df1236a82bdc6b315660f93ed5b11e (patch) | |
| tree | 8e79dbce3b30eced26b6b88b917d77e2a9fbef28 | |
| parent | ea369cbc2f733568779215fd2aa68a54d5b75327 (diff) | |
| download | rust-a1c79056e5df1236a82bdc6b315660f93ed5b11e.tar.gz rust-a1c79056e5df1236a82bdc6b315660f93ed5b11e.zip | |
Improved the example with numbers that can be exactly represented as floats and added a comment with the solution.
| -rw-r--r-- | src/libcore/ops/arith.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcore/ops/arith.rs b/src/libcore/ops/arith.rs index 484461687e4..77c2dfa51bb 100644 --- a/src/libcore/ops/arith.rs +++ b/src/libcore/ops/arith.rs @@ -545,10 +545,11 @@ macro_rules! rem_impl_float { /// /// # Examples /// ``` - /// let x: f32 = 4.0; - /// let y: f32 = 2.5; + /// let x: f32 = 50.50; + /// let y: f32 = 8.125; /// let remainder = x - (x / y).trunc() * y; /// + /// // The answer to both operations is 1.75 /// assert_eq!(x % y, remainder); /// ``` #[stable(feature = "rust1", since = "1.0.0")] |
