INT

From C64-Wiki

Jump to: navigation, search
BASIC keyword
Keyword:INT
Abbreviation:
Type:Function
Token code:181/$B5
Handling routine
in BASIC ROM:
48332–48360
$BCCC–BCE8
List of all BASIC keywords


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

Typ: Integer Function 
General Programming-Syntax: INT(<Numeric>)

INT is using for rounding numbers, whereas the rounding is not 100% correct. By numbers with positive prefix the floating point will be cut, while by numbers with neagtive prefix the next lower value is viewed.

When 0,5 is summated to the output the mathemathical conventions are adhered.

When the term isn't a number, the BASIC error ?TYPE MISMATCH ERROR IN line occurrs. It can be only used number with values from -1e+38 until 1e+38. Then this area is out of range the BASIC error?OVERFLOW ERROR IN line is viewing. When the numeric argument is absent, it appears a ?SYNTAX ERROR IN line.

[edit] Examples

PRINT INT(1.53)   Screen: 1
PRINT INT(-9.47)  Screen: -10
       for correct rounding sum 0,5
PRINT INT((1.53)+0.5)   Screen: 2
PRINT INT((-9.47)+0.5)  Screen: -9
BASIC V2.0-Commands of Commodore 64

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

 
Personal tools
Help and Feedback
In other languages