about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian <chris_veenman@hotmail.com>2019-04-01 22:49:14 +0200
committerChristian <chris_veenman@hotmail.com>2019-04-01 22:49:14 +0200
commita1c79056e5df1236a82bdc6b315660f93ed5b11e (patch)
tree8e79dbce3b30eced26b6b88b917d77e2a9fbef28
parentea369cbc2f733568779215fd2aa68a54d5b75327 (diff)
downloadrust-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.rs5
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")]