Documentation moved.
This entry is documented with its primary interface. Open the documentation →
Function
src/index.ts:884nerdamer.atan2
nerdamer.atan2(y: ExpressionInput, x: ExpressionInput): ExpressionComputes the two-argument arctangent atan2(y, x), which returns the angle
in radians between the positive x-axis and the point (x, y).
Unlike atan, atan2 correctly handles all four quadrants and returns
values in the range (−π, π]. Returns exact multiples of π where possible.
throws
core!UndefinedError If both x and y are zero, or both are ±∞.
see
https://en.wikipedia.org/wiki/Atan2
Parameters
| Name | Type | Description |
|---|---|---|
y | ExpressionInput | The y-coordinate. |
x | ExpressionInput | The x-coordinate. |
Returns
Expression — The angle in radians.
Examples
atan2(1, 1).text() // "1/4*pi"
atan2(0, 1).text() // "0"
atan2(1, 0).text() // "1/2*pi"
atan2(-1, 0).text() // "-1/2*pi"
// Symbolic
atan2('y', 'x').text() // "atan2(y, x)"