Rollup merge of #126468 - RalfJung:euclid, r=Mark-Simulacrum

div_euclid, rem_euclid: clarify/extend documentation
This commit is contained in:
许杰友 Jieyou Xu (Joe) 2024-06-17 04:53:56 +01:00 committed by GitHub
commit f39327bcf2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2784,8 +2784,10 @@ pub const fn isqrt(self) -> Self {
/// ///
/// In other words, the result is `self / rhs` rounded to the integer `q` /// In other words, the result is `self / rhs` rounded to the integer `q`
/// such that `self >= q * rhs`. /// 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 rounding towards zero (the default in Rust);
/// if `self < 0`, this is equal to round towards +/- infinity. /// if `self < 0`, this is equal to rounding away from zero (towards +/- infinity).
/// If `rhs > 0`, this is equal to rounding towards -infinity;
/// if `rhs < 0`, this is equal to rounding towards +infinity.
/// ///
/// # Panics /// # Panics
/// ///
@ -2823,8 +2825,8 @@ pub const fn div_euclid(self, rhs: Self) -> Self {
/// Calculates the least nonnegative remainder of `self (mod rhs)`. /// Calculates the least nonnegative remainder of `self (mod rhs)`.
/// ///
/// This is done as if by the Euclidean division algorithm -- given /// This is done as if by the Euclidean division algorithm -- given
/// `r = self.rem_euclid(rhs)`, `self = rhs * self.div_euclid(rhs) + r`, and /// `r = self.rem_euclid(rhs)`, the result satisfies
/// `0 <= r < abs(rhs)`. /// `self = rhs * self.div_euclid(rhs) + r` and `0 <= r < abs(rhs)`.
/// ///
/// # Panics /// # Panics
/// ///