Skip to content

Commit 77c0a48

Browse files
committed
Fix inequality in docs for div_euclid
This commit fixes the statement of the inequality that the Euclidean remainder satisfies. (The remainder is guaranteed to be less than abs(rhs), not rhs.) It also rewords the documentation to make it a little easier to read.
1 parent 5233edc commit 77c0a48

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/num/int_macros.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1589,11 +1589,11 @@ macro_rules! int_impl {
15891589

15901590
/// Calculates the quotient of Euclidean division of `self` by `rhs`.
15911591
///
1592-
/// This computes the integer `n` such that `self = n * rhs + self.rem_euclid(rhs)`,
1593-
/// with `0 <= self.rem_euclid(rhs) < rhs`.
1592+
/// This computes the integer `q` such that `self = q * rhs + r`, with
1593+
/// `r = self.rem_euclid(rhs)` and `0 <= r < abs(rhs)`.
15941594
///
1595-
/// In other words, the result is `self / rhs` rounded to the integer `n`
1596-
/// such that `self >= n * rhs`.
1595+
/// In other words, the result is `self / rhs` rounded to the integer `q`
1596+
/// such that `self >= q * rhs`.
15971597
/// If `self > 0`, this is equal to round towards zero (the default in Rust);
15981598
/// if `self < 0`, this is equal to round towards +/- infinity.
15991599
///

0 commit comments

Comments
 (0)