diff options
| author | 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> | 2024-06-17 04:53:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-17 04:53:56 +0100 |
| commit | f39327bcf22db3a6c14888eec18c704bdbcda1fd (patch) | |
| tree | 00c58f6eba0a06ff5e16bc3405451d5046ce1479 | |
| parent | cd4c0f06daddd6f3b1f18ede64584f1505f1bc9b (diff) | |
| parent | 9e851041d7b7631217857067f80b461543844c24 (diff) | |
| download | rust-f39327bcf22db3a6c14888eec18c704bdbcda1fd.tar.gz rust-f39327bcf22db3a6c14888eec18c704bdbcda1fd.zip | |
Rollup merge of #126468 - RalfJung:euclid, r=Mark-Simulacrum
div_euclid, rem_euclid: clarify/extend documentation
| -rw-r--r-- | library/core/src/num/int_macros.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/library/core/src/num/int_macros.rs b/library/core/src/num/int_macros.rs index 55bb6166f10..44889484963 100644 --- a/library/core/src/num/int_macros.rs +++ b/library/core/src/num/int_macros.rs @@ -2784,8 +2784,10 @@ macro_rules! int_impl { /// /// 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. + /// If `self > 0`, this is equal to rounding towards zero (the default in Rust); + /// 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 /// @@ -2823,8 +2825,8 @@ macro_rules! int_impl { /// Calculates the least nonnegative remainder of `self (mod rhs)`. /// /// This is done as if by the Euclidean division algorithm -- given - /// `r = self.rem_euclid(rhs)`, `self = rhs * self.div_euclid(rhs) + r`, and - /// `0 <= r < abs(rhs)`. + /// `r = self.rem_euclid(rhs)`, the result satisfies + /// `self = rhs * self.div_euclid(rhs) + r` and `0 <= r < abs(rhs)`. /// /// # Panics /// |
