ATN

From C64-Wiki
Jump to: navigation, search
BASIC keyword
Keyword: ATN
Abbreviation: A Shift+T
Type: Function
Token code: 192/$C1
Handling routine
in BASIC ROM:
58126–58234
$E30E–E37A
List of all BASIC keywords


Remark: This article describes the BASIC-Command ATN in BASIC V2 at the Commodore 64.

Type: Numeric Function
General Programming-Syntax: ATN(<numeric-expression>)

The numerical function ATN is a mathematical function that returns the arc tangent of a numeric value (the inverse function of TAN). The resulting value is the angle in radians of the given tangent. To convert radians into degrees use the formula (rad*180/π) where rad is the angle in radians.

If the term given in the parentheses is non-numerical, the BASIC error ?TYPE MISMATCH ERROR occurrs. Being a floating point argument, the term must be in the range of ±2.93873588·10−38 to ±1.70141183·1038. Exceeding these limits yields the BASIC error?OVERFLOW ERROR. Omitting the numeric argument or to many arguments results in a ?SYNTAX ERROR.

Examples[edit]

PRINT ATN(1)

Output: 0.785398163

PRINT ATN(1)*4

Output: 3.1415266
The result is equivalent to π, but differs slightly from π caused by the iterative internal calculation.


BASIC V2.0 (second release) Commands

ABS | AND | ASC | ATN | CHR$ | CLOSE | CLR | CMD | CONT | COS | DATA | DEF | DIM | END | EXP | FN | FOR | FRE | GET | GET# | GOSUB | GOTO | IF | INPUT | INPUT# | INT | LEFT$ | LEN | LET | LIST | LOAD | LOG | MID$ | NEW | NEXT | NOT | ON | OPEN | OR | PEEK | π  |POKE | POS | PRINT | PRINT# | READ | REM | RESTORE | RETURN | RIGHT$ | RND | RUN | SAVE | SGN | SIN | SPC | SQR | STATUS/ST | STEP | STOP | STR$ | SYS | TAB | TAN | THEN | TIME/TI | TIME$/TI$ | TO | USR | VAL | VERIFY | WAIT