JavaScript Editor js editor     Web development 



Main Page

Returns the arc tangent in all four quadrants from specified values.

ATN2(nYCoordinate, nXCoordinate)

Parameters

nYCoordinate


Specifies the y coordinate.
nXCoordinate


Specifies the x coordinate.

Return Value

Numeric

Remarks

ATN2(В ) returns the angle (in radians) between the line y = 0 and the line connecting the specified coordinates and the origin (0, 0) of the coordinate system.

ATN2( ) returns a value between – pi/2 and +pi/2.

You can convert the value returned by ATN2(В ) to degrees with RTOD(В ). You can specify the number of decimal places that are displayed in the result with SET DECIMALS.

Example

В Copy Code
CLEAR
? PI( )  && Displays 3.14
? ATN2(0,-1)  && Displays 3.14
STORE COS(PI( )) TO gnXCoord
STORE SIN(PI( )) TO gnYCoord
? ATN2(gnYCoord,gnXCoord)  && Displays 3.14
? ATN2(gnYCoord,gnXCoord)/PI( )  && Displays 1.00

See Also



JavaScript Editor js editor     Web development