This content has been marked as final.
Show 5 replies

1. Re: Simple rounding trick needed
Newsgroup_User Jun 12, 2006 9:20 AM (in response to Circusmich)Could be a better way than this, but you could define your own function.
Something like this. Basically performs the division and adds 1 if there is
any remainder.
on roundUpDivision numerator, denominator
result = numerator / denominator
if numerator mod denominator <> 0 then result = result + 1
return result
end

2. Re: Simple rounding trick needed
Newsgroup_User Jun 12, 2006 9:49 AM (in response to Circusmich)FYI, you can also use the ceil method of the Flash Math class:
p = newObject("math")
put p.ceil(5/4.0)
 2.0000

Dave 
Adobe Community Expert
www.blurredistinction.com
http://www.adobe.com/communities/experts/

3. Re: Simple rounding trick needed
Circusmich Jun 12, 2006 1:07 PM (in response to Newsgroup_User)Works like a charm! But I have no idea how it does the trick. I can't find this type of code in my Director 8 dymistified book :) Do you know where I can find more on this topic?
Thanks a lot!
Mich 
4. Re: Simple rounding trick needed
Newsgroup_User Jun 12, 2006 2:56 PM (in response to Newsgroup_User)>>Do you know where I can find more on this topic?
I'm not 100% sure what your question is, sorry. If you mean more on the
Flash math object, you can find that in the Flash help docs. Creating Flash
objects, is covered in some detail in the Director docs, but there aren't
specific bits of code  as again, those would be in the Flash help. If you
have specific questions though, please ask.

Dave 
Adobe Community Expert
www.blurredistinction.com
http://www.adobe.com/communities/experts/

5. Re: Simple rounding trick needed
Newsgroup_User Jun 13, 2006 6:04 AM (in response to Newsgroup_User)Circusmich wrote:
> Works like a charm! But I have no idea how it does the trick. I can't
> find this type of code in my Director 8 dymistified book :) Do you
> know where I can find more on this topic?
>
> Thanks a lot!
>
> Mich
>
> p = newObject("math")
> put p.ceil(5/4.0)
It might be faster to use pure Lingo:
on ceiling(x)
chopped=bitOr(x, 0)
if x=chopped then
return chopped
end if
if x>0 then
return chopped+1
else
return chopped1
end if
end
If you need stuff about maths, then try http://mathworld.wolfram.com/ or
http://mathforum.org/.
Andrew