Posts filed under 'Math'

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


Director Sites

Calendar

December 2024
M T W T F S S
« Feb    
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Archives

Recent Posts

Recent Comments