Condividi tramite


ATN2( ) Function

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

ATN2(nYCoordinate, nXCoordinate)

Return Values

Numeric

Parameters

  • nYCoordinate
    Specifies the y coordinate.
  • nXCoordinate
    Specifies the x coordinate.

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

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

ATAN( ) | DTOR( ) | RTOD( ) | SET DECIMALS | TAN( )