Cover edge cases for {f32, f64}.hypot() docs

Re-phrase in a way that handles input values being either 0 or
negative.
This commit is contained in:
jmaargh 2023-04-13 22:26:38 +01:00
parent e4dae0dac7
commit cd868dcf98
2 changed files with 8 additions and 4 deletions

View File

@ -581,8 +581,10 @@ impl f32 {
unsafe { cmath::cbrtf(self) }
}
/// Calculates the length of the hypotenuse of a right-angle triangle given
/// legs of length `x` and `y`.
/// Compute the distance between the origin and a point (`x`, `y`) on the
/// Euclidean plane. Equivalently, compute the length of the hypotenuse of a
/// right-angle triangle with other sides having length `x.abs()` and
/// `y.abs()`.
///
/// # Examples
///

View File

@ -583,8 +583,10 @@ impl f64 {
unsafe { cmath::cbrt(self) }
}
/// Calculates the length of the hypotenuse of a right-angle triangle given
/// legs of length `x` and `y`.
/// Compute the distance between the origin and a point (`x`, `y`) on the
/// Euclidean plane. Equivalently, compute the length of the hypotenuse of a
/// right-angle triangle with other sides having length `x.abs()` and
/// `y.abs()`.
///
/// # Examples
///