Floor returns a decimal value to an integer as follows:

Values greater than zero return the next integer towards zero.  

Values less than zero return the next integer away from zero.

Syntax:

value = Floor( AnyValue )

 

Parameter:

Description:

AnyValue

Any numeric value, Or any expression that results in a numeric value.

 

Example:

'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'  BPV Manual Series Test Values
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
dVal[1] = -1.50
dVal[2] = -1.00
dVal[3] = -0.50
dVal[4] =  0.00
dVal[5] =  0.50
dVal[6] =  1.00
dVal[7] =  1.50
 
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PRINT "Floor Function:"
PRINT "---------------"
 
FOR Ndx = 1 TO 7
  '   Floor Calculations
  PRINT "Floor(" + AsString(dVal[Ndx], 2) + ") = ", Floor( dVal[Ndx] )
Next '   Ndx
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Returns:

Floor Function:
  ----------------
  Floor(-1.50) =  -2
  Floor(-1.00) =  -1
  Floor(-0.50) =  -1
  Floor(0.00) =  0
  Floor(0.50) =  0
  Floor(1.00) =  1
  Floor(1.50) =  1

 

Links:

AsInteger, AsString, Ceiling, FOR, PRINT

See Also:

Mathematical Functions

 


Edit Time: 9/25/2017 09:09:58 AM


Topic ID#: 345

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software