提交 7f82ddb8 编写于 作者: B bors

Auto merge of #82680 - jturner314:div_euclid-docs, r=JohnTitor

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.

(You might wonder why I've written `abs(rhs)` instead of `rhs.abs()`. Two reasons: first, the `rem_euclid` docs use `abs(rhs)` instead of `rhs.abs()`, and second, the absolute value here is the mathematical absolute value, not the the `.abs()` operation which may overflow.)
......@@ -1589,11 +1589,11 @@ pub const fn pow(self, mut exp: u32) -> Self {
/// Calculates the quotient of Euclidean division of `self` by `rhs`.
///
/// This computes the integer `n` such that `self = n * rhs + self.rem_euclid(rhs)`,
/// with `0 <= self.rem_euclid(rhs) < rhs`.
/// This computes the integer `q` such that `self = q * rhs + r`, with
/// `r = self.rem_euclid(rhs)` and `0 <= r < abs(rhs)`.
///
/// In other words, the result is `self / rhs` rounded to the integer `n`
/// such that `self >= n * rhs`.
/// In other words, the result is `self / rhs` rounded to the integer `q`
/// such that `self >= q * rhs`.
/// If `self > 0`, this is equal to round towards zero (the default in Rust);
/// if `self < 0`, this is equal to round towards +/- infinity.
///
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册