AddListItem

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


View Updates

Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.



Hacker's Guide to Visual FoxPro 7. 0
Hackers Guide to Visual FoxPro 7.0
ISBN: 1930919220
EAN: 2147483647
Year: 2001
Pages: 899

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net