INT function

Purpose: Converts a floating point number to an integer.


 Syntax:

 RetVal% = INT(Number)

 Parameters:

  • RetVal% INT returns the greatest integer less than or equal to floating point Number.
  • Number Floating point number to be converted to an integer.

Example:

 
 DIM RetVal%

 RetVal% = FIX(0.4):  PRINT " FIX(0.4) ",RetVal%
 RetVal% = FIX(0.6):  PRINT " FIX(0.6) ",RetVal%
 RetVal% = FIX(-0.4): PRINT "FIX(-0.4) ",RetVal%
 RetVal% = FIX(-0.6): PRINT "FIX(-0.6) ",RetVal%
 RetVal% = FIX(1.4):  PRINT " FIX(1.4) ",RetVal%
 RetVal% = FIX(1.6):  PRINT " FIX(1.6) ",RetVal%
 RetVal% = FIX(-1.4): PRINT "FIX(-1.4) ",RetVal%
 RetVal% = FIX(-1.6): PRINT "FIX(-1.6) ",RetVal%
 PRINT " "
 RetVal% = INT(0.4):  PRINT " INT(0.4) ",RetVal%
 RetVal% = INT(0.6):  PRINT " INT(0.6) ",RetVal%
 RetVal% = INT(-0.4): PRINT "INT(-0.4) ",RetVal%
 RetVal% = INT(-0.6): PRINT "INT(-0.6) ",RetVal%
 RetVal% = INT(1.4):  PRINT " INT(1.4) ",RetVal%
 RetVal% = INT(1.6):  PRINT " INT(1.6) ",RetVal%
 RetVal% = INT(-1.4): PRINT "INT(-1.4) ",RetVal%
 RetVal% = INT(-1.6): PRINT "INT(-1.6) ",RetVal%

Result:



 FIX(0.4)  0
 FIX(0.6)  0
FIX(-0.4)  0
FIX(-0.6)  0
 FIX(1.4)  1
 FIX(1.6)  1
FIX(-1.4) -1
FIX(-1.6) -1

 INT(0.4)  0
 INT(0.6)  0
INT(-0.4) -1
INT(-0.6) -1
 INT(1.4)  1
 INT(1.6)  1
INT(-1.4) -2
INT(-1.6) -2