Skip to content

Latest commit

 

History

History
24 lines (17 loc) · 1.12 KB

s4g050.md

File metadata and controls

24 lines (17 loc) · 1.12 KB

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()