Skip to content

Commit a1c7905

Browse files
author
Christian
committed
Improved the example with numbers that can be exactly represented as floats and added a comment with the solution.
1 parent ea369cb commit a1c7905

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/libcore/ops/arith.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,11 @@ macro_rules! rem_impl_float {
545545
///
546546
/// # Examples
547547
/// ```
548-
/// let x: f32 = 4.0;
549-
/// let y: f32 = 2.5;
548+
/// let x: f32 = 50.50;
549+
/// let y: f32 = 8.125;
550550
/// let remainder = x - (x / y).trunc() * y;
551551
///
552+
/// // The answer to both operations is 1.75
552553
/// assert_eq!(x % y, remainder);
553554
/// ```
554555
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)