Skip to content

Commit

Permalink
Rollup merge of rust-lang#49254 - Tacklebox:atan2_doc, r=QuietMisdreavus
Browse files Browse the repository at this point in the history
Fixed clockwise/counter-clockwise in atan2 documentation in f32 and f64 and included that it returns radians

None
  • Loading branch information
kennytm authored Mar 24, 2018
2 parents 23967c3 + c116b0e commit 88277f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/libstd/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ impl 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]`
Expand All @@ -791,12 +791,13 @@ impl 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;
///
Expand Down
9 changes: 5 additions & 4 deletions src/libstd/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ impl 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]`
Expand All @@ -727,12 +727,13 @@ impl 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;
///
Expand Down

0 comments on commit 88277f5

Please sign in to comment.