From a1c79056e5df1236a82bdc6b315660f93ed5b11e Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 1 Apr 2019 22:49:14 +0200 Subject: [PATCH] Improved the example with numbers that can be exactly represented as floats and added a comment with the solution. --- src/libcore/ops/arith.rs | 5 +++-- 1 file 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")]