Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit cd1c998

Browse files
authoredJun 17, 2024
Rollup merge of rust-lang#126468 - RalfJung:euclid, r=Mark-Simulacrum
div_euclid, rem_euclid: clarify/extend documentation
2 parents 2730879 + 3909d51 commit cd1c998

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎core/src/num/int_macros.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -2784,8 +2784,10 @@ macro_rules! int_impl {
27842784
///
27852785
/// In other words, the result is `self / rhs` rounded to the integer `q`
27862786
/// such that `self >= q * rhs`.
2787-
/// If `self > 0`, this is equal to round towards zero (the default in Rust);
2788-
/// if `self < 0`, this is equal to round towards +/- infinity.
2787+
/// If `self > 0`, this is equal to rounding towards zero (the default in Rust);
2788+
/// if `self < 0`, this is equal to rounding away from zero (towards +/- infinity).
2789+
/// If `rhs > 0`, this is equal to rounding towards -infinity;
2790+
/// if `rhs < 0`, this is equal to rounding towards +infinity.
27892791
///
27902792
/// # Panics
27912793
///
@@ -2823,8 +2825,8 @@ macro_rules! int_impl {
28232825
/// Calculates the least nonnegative remainder of `self (mod rhs)`.
28242826
///
28252827
/// This is done as if by the Euclidean division algorithm -- given
2826-
/// `r = self.rem_euclid(rhs)`, `self = rhs * self.div_euclid(rhs) + r`, and
2827-
/// `0 <= r < abs(rhs)`.
2828+
/// `r = self.rem_euclid(rhs)`, the result satisfies
2829+
/// `self = rhs * self.div_euclid(rhs) + r` and `0 <= r < abs(rhs)`.
28282830
///
28292831
/// # Panics
28302832
///

0 commit comments

Comments
 (0)
Failed to load comments.