about summary refs log tree commit diff
diff options
context:
space:
mode:
authorjmaargh <jmaargh@gmail.com>2023-04-13 22:26:38 +0100
committerjmaargh <jmaargh@gmail.com>2023-04-13 22:41:55 +0100
commitcd868dcf987b71148bc40271aede9f5b02645c26 (patch)
treeb3e043978620ef9528540e207b59faa0d87e57da
parente4dae0dac76436ada630b519f5fbf0b373bc5974 (diff)
downloadrust-cd868dcf987b71148bc40271aede9f5b02645c26.tar.gz
rust-cd868dcf987b71148bc40271aede9f5b02645c26.zip
Cover edge cases for {f32, f64}.hypot() docs
Re-phrase in a way that handles input values being either 0 or
negative.
-rw-r--r--library/std/src/f32.rs6
-rw-r--r--library/std/src/f64.rs6
2 files changed, 8 insertions, 4 deletions
diff --git a/library/std/src/f32.rs b/library/std/src/f32.rs
index c7c33678fd3..408244b2ce9 100644
--- a/library/std/src/f32.rs
+++ b/library/std/src/f32.rs
@@ -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
     ///
diff --git a/library/std/src/f64.rs b/library/std/src/f64.rs
index b1faa670307..6782b861f11 100644
--- a/library/std/src/f64.rs
+++ b/library/std/src/f64.rs
@@ -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
     ///