]> git.lizzy.rs Git - rust.git/commitdiff
Fixed clockwise/counter-clockwise in atan2 documentation in f32 and f64
authorMaxwell Borden <maxwellborden@gmail.com>
Thu, 22 Mar 2018 01:11:57 +0000 (18:11 -0700)
committerMaxwell Borden <maxwellborden@gmail.com>
Thu, 22 Mar 2018 01:11:57 +0000 (18:11 -0700)
and included that it returns radians

src/libstd/f32.rs
src/libstd/f64.rs

index a760922115aef330ebb44463d4412c687e1cbbc4..ceb019bc95b4c3588cadf9803914284989aae7c6 100644 (file)
@@ -780,7 +780,7 @@ pub fn atan(self) -> f32 {
         unsafe { cmath::atanf(self) }
     }
 
-    /// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`).
+    /// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
     ///
     /// * `x = 0`, `y = 0`: `0`
     /// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
@@ -791,12 +791,13 @@ pub fn atan(self) -> f32 {
     /// use std::f32;
     ///
     /// let pi = f32::consts::PI;
-    /// // All angles from horizontal right (+x)
-    /// // 45 deg counter-clockwise
+    /// // Positive angles measured counter-clockwise
+    /// // from positive x axis
+    /// // -pi/4 radians (45 deg clockwise)
     /// let x1 = 3.0f32;
     /// let y1 = -3.0f32;
     ///
-    /// // 135 deg clockwise
+    /// // 3pi/4 radians (135 deg counter-clockwise)
     /// let x2 = -3.0f32;
     /// let y2 = 3.0f32;
     ///
index 6f34f176a971155b09c2d3e5ecad66cd56002ac7..97adf108b73b0be4f6a2970b56011d29195836a7 100644 (file)
@@ -716,7 +716,7 @@ pub fn atan(self) -> f64 {
         unsafe { cmath::atan(self) }
     }
 
-    /// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`).
+    /// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
     ///
     /// * `x = 0`, `y = 0`: `0`
     /// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
@@ -727,12 +727,13 @@ pub fn atan(self) -> f64 {
     /// use std::f64;
     ///
     /// let pi = f64::consts::PI;
-    /// // All angles from horizontal right (+x)
-    /// // 45 deg counter-clockwise
+    /// // Positive angles measured counter-clockwise
+    /// // from positive x axis
+    /// // -pi/4 radians (45 deg clockwise)
     /// let x1 = 3.0_f64;
     /// let y1 = -3.0_f64;
     ///
-    /// // 135 deg clockwise
+    /// // 3pi/4 radians (135 deg counter-clockwise)
     /// let x2 = -3.0_f64;
     /// let y2 = 3.0_f64;
     ///