﻿ Ceiling

# Ceiling

Ceiling returns a decimal value to an integer as follows:

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

Values less than zero return the next integer towards zero.

Syntax:

Ceiling( 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 "Ceiling Function"
PRINT "----------------"

FOR Ndx = 1 TO 7
'   Ceiling Calculation
PRINT "Ceiling(" + AsString(dVal[Ndx], 2) + ") = ", Ceiling( dVal[Ndx] )
Next '   Ndx
'  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Returns:

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