Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
FIX, and INT Functions Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
' This example compares output from INT, CINT, and FIX:
' • INT rounds down for positive numbers, up for negative numbers
' • FIX always rounds down (towards 0)
' • CINT rounds off (at .5, CINT rounds towards the nearest even integer)
' To try this example:
' 1. Choose New Project from the File menu
' 2. Copy the example code below to the code window
' 3. Press F5 to run the example
CLS ' Clear the screen
PRINT " N", "INT(N)", "FIX(N)", "CINT(N)"
N! = 99.3
FOR count% = 1 TO 3
PRINT N!, INT(N!), FIX(N!), CINT(N!)
N! = N! + .2
NEXT
PRINT
N! = -99.7
FOR count% = 1 TO 3
PRINT N!, INT(N!), FIX(N!), CINT(N!)
N! = N! + .2
NEXT