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

March 2024
M T W T F S S
« Feb    
 123
45678910
11121314151617
18192021222324
25262728293031

Archives

Recent Posts

Recent Comments