Ceiling(), Floor()

These two functions have nothing to do with architecture, despite their names. They implement the mathematical concept of ceiling and floor, traditionally written with the symbols "" and "". The ceiling of a number is the next integer greater than or equal to the number, while the floor is the next integer less than or equal to the number. So, the ceiling or floor of an integer is the number itself. CEILING() and FLOOR() work on all the numeric types.

Usage

nResult = CEILING( nValue )
nResult = FLOOR( nValue )
Be careful when applying these functions to negative numbers. You may find the results a little counter-intuitive. For positive numbers, FLOOR() and INT() are the same. For negative numbers, CEILING() and INT() are the same. CEILING() and FLOOR() both return .NULL. when handed a null value.

Example

? CEILING(3.14159)  && 4
? FLOOR(3.14159)    && 3
? CEILING(-17.385)  && -17
? FLOOR(-17.385)    && -18

See Also

Int(), Max(), Min(), Mod(), Round()


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .