Skip to content

Commit 4d52fa8

Browse files
authored
Rollup merge of rust-lang#146451 - DimitriiTrater:atan2_correctness_docs, r=tgross35
Fix atan2 inaccuracy in documentation Fixes rust-lang#136275
2 parents 79e39df + d834935 commit 4d52fa8

File tree

4 files changed

+24
-16
lines changed

4 files changed

+24
-16
lines changed

library/std/src/num/f128.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -557,10 +557,12 @@ impl f128 {
557557

558558
/// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
559559
///
560-
/// * `x = 0`, `y = 0`: `0`
561-
/// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
562-
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
563-
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
560+
/// | `x` | `y` | Piecewise Definition | Range |
561+
/// |---------|---------|----------------------|---------------|
562+
/// | `>= +0` | `>= +0` | `arctan(y/x)` | `[+0, +pi/2]` |
563+
/// | `>= +0` | `<= -0` | `arctan(y/x)` | `[-pi/2, -0]` |
564+
/// | `<= -0` | `>= +0` | `arctan(y/x) + pi` | `[+pi/2, +pi]`|
565+
/// | `<= -0` | `<= -0` | `arctan(y/x) - pi` | `[-pi, -pi/2]`|
564566
///
565567
/// # Unspecified precision
566568
///

library/std/src/num/f16.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -522,10 +522,12 @@ impl f16 {
522522

523523
/// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
524524
///
525-
/// * `x = 0`, `y = 0`: `0`
526-
/// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
527-
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
528-
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
525+
/// | `x` | `y` | Piecewise Definition | Range |
526+
/// |---------|---------|----------------------|---------------|
527+
/// | `>= +0` | `>= +0` | `arctan(y/x)` | `[+0, +pi/2]` |
528+
/// | `>= +0` | `<= -0` | `arctan(y/x)` | `[-pi/2, -0]` |
529+
/// | `<= -0` | `>= +0` | `arctan(y/x) + pi` | `[+pi/2, +pi]`|
530+
/// | `<= -0` | `<= -0` | `arctan(y/x) - pi` | `[-pi, -pi/2]`|
529531
///
530532
/// # Unspecified precision
531533
///

library/std/src/num/f32.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,12 @@ impl f32 {
827827

828828
/// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
829829
///
830-
/// * `x = 0`, `y = 0`: `0`
831-
/// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
832-
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
833-
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
830+
/// | `x` | `y` | Piecewise Definition | Range |
831+
/// |---------|---------|----------------------|---------------|
832+
/// | `>= +0` | `>= +0` | `arctan(y/x)` | `[+0, +pi/2]` |
833+
/// | `>= +0` | `<= -0` | `arctan(y/x)` | `[-pi/2, -0]` |
834+
/// | `<= -0` | `>= +0` | `arctan(y/x) + pi` | `[+pi/2, +pi]`|
835+
/// | `<= -0` | `<= -0` | `arctan(y/x) - pi` | `[-pi, -pi/2]`|
834836
///
835837
/// # Unspecified precision
836838
///

library/std/src/num/f64.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -827,10 +827,12 @@ impl f64 {
827827

828828
/// Computes the four quadrant arctangent of `self` (`y`) and `other` (`x`) in radians.
829829
///
830-
/// * `x = 0`, `y = 0`: `0`
831-
/// * `x >= 0`: `arctan(y/x)` -> `[-pi/2, pi/2]`
832-
/// * `y >= 0`: `arctan(y/x) + pi` -> `(pi/2, pi]`
833-
/// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)`
830+
/// | `x` | `y` | Piecewise Definition | Range |
831+
/// |---------|---------|----------------------|---------------|
832+
/// | `>= +0` | `>= +0` | `arctan(y/x)` | `[+0, +pi/2]` |
833+
/// | `>= +0` | `<= -0` | `arctan(y/x)` | `[-pi/2, -0]` |
834+
/// | `<= -0` | `>= +0` | `arctan(y/x) + pi` | `[+pi/2, +pi]`|
835+
/// | `<= -0` | `<= -0` | `arctan(y/x) - pi` | `[-pi, -pi/2]`|
834836
///
835837
/// # Unspecified precision
836838
///

0 commit comments

Comments
 (0)