Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

div_euclid, rem_euclid: clarify/extend documentation #126468

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions library/core/src/num/int_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down Expand Up @@ -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
///
Expand Down
Loading