Skip to content

Commit

Permalink
Editorial: fix algorithm of Math.atan2 (#3170)
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-Cena authored and ljharb committed Feb 5, 2024
1 parent 94bf7d5 commit ddb41dd
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -31937,7 +31937,13 @@ <h1>Math.atan2 ( _y_, _x_ )</h1>
1. If _nx_ is *-∞*<sub>𝔽</sub>, return an implementation-approximated Number value representing -π.
1. If _nx_ is either *+0*<sub>𝔽</sub> or *-0*<sub>𝔽</sub>, return an implementation-approximated Number value representing -π / 2.
1. Assert: _nx_ is finite and is neither *+0*<sub>𝔽</sub> nor *-0*<sub>𝔽</sub>.
1. Return an implementation-approximated Number value representing the result of the inverse tangent of the quotient ℝ(_ny_) / ℝ(_nx_).
1. Let _r_ be the inverse tangent of abs(ℝ(_ny_) / ℝ(_nx_)).
1. If _nx_ &lt; *-0*<sub>𝔽</sub>, then
1. If _ny_ > *+0*<sub>𝔽</sub>, set _r_ to π - _r_.
1. Else, set _r_ to -π + _r_.
1. Else,
1. If _ny_ &lt; *-0*<sub>𝔽</sub>, set _r_ to -_r_.
1. Return an implementation-approximated Number value representing _r_.
</emu-alg>
</emu-clause>

Expand Down

0 comments on commit ddb41dd

Please sign in to comment.