round and statRound

Jeanne A. E. DeVoto revolution at jaedworks.com
Wed Apr 13 22:56:11 EDT 2005


At 8:28 PM +0100 4/13/05, David Burgun wrote:
>>no, use:
>>
>>trunc(1.5)+1
>
>Thanks! There should be a mention of this on the round and statRound 
>documentation pages!

There's a See Also link to the cookbook recipe for "Rounding a number 
up to a ceiling". (Or at least there used to be.) The function given 
there looks like this:

function ceiling theNumber
   if theNumber is not a number then return "Error: not a number"
   if theNumber < zero or theNumber is an integer then
     return trunc(theNumber)
   else
     return trunc(theNumber) + 1
   end if
end ceiling

which is more verbose than the equivalents that have been given here, 
but also, I think, a little easier to figure out for beginners.
-- 
jeanne a. e. devoto ~ revolution at jaedworks.com
http://www.jaedworks.com


More information about the use-livecode mailing list