Skip to content

Commit d834935

Browse files
Fix atan2 inaccuracy in documentation
1 parent 76c5ed2 commit d834935

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
@@ -826,10 +826,12 @@ impl f32 {
826826

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

library/std/src/num/f64.rs

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

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

0 commit comments

Comments
 (0)