Ceiling and Floor in Lingo
People occasionally have questions when trying to find a ceiling or floor function in the Lingo library so I figured I’d post it here for future googlers.
Lingo didn’t include these two math functions, but you can write your own functions and keep them in your personal library of goodies.
on floor aFloat return integer(aFloat) - (aFloat < integer(aFloat)) end on ceil aFloat return integer(aFloat) + (aFloat > integer(aFloat)) end
If you are working with Javascript these functions are built in:
Math.ceil(aFloat); Math.floor(aFloat);
2 comments February 3rd, 2009