mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Rollup merge of #155558 - nivekithan:issue-154000-fix, r=jhpratt
Clarify that isqrt returns the principal (non-negative) square root Clarify which root is returned from `isqrt` and `checked_isqrt` Fixes: https://github.com/rust-lang/rust/issues/154000 Previous PRs: https://github.com/rust-lang/rust/pull/154462
This commit is contained in:
@@ -1911,7 +1911,11 @@ pub const fn strict_pow(self, mut exp: u32) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the square root of the number, rounded down.
|
||||
/// Returns the integer square root of the number, rounded down.
|
||||
///
|
||||
/// This function returns the **principal (non-negative) square root**.
|
||||
/// For a given number `n`, although both `x` and `-x` satisfy x<sup>2</sup> = n,
|
||||
/// this function always returns the non-negative value.
|
||||
///
|
||||
/// Returns `None` if `self` is negative.
|
||||
///
|
||||
@@ -3206,7 +3210,11 @@ pub const fn pow(self, mut exp: u32) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the square root of the number, rounded down.
|
||||
/// Returns the integer square root of the number, rounded down.
|
||||
///
|
||||
/// This function returns the **principal (non-negative) square root**.
|
||||
/// For a given number `n`, although both `x` and `-x` satisfy x<sup>2</sup> = n,
|
||||
/// this function always returns the non-negative value.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user