Re: Round Handler, care to share.
Re: Round Handler, care to share.
- Subject: Re: Round Handler, care to share.
- From: Carl West <email@hidden>
- Date: Wed, 06 Dec 2000 17:03:28 -0500
- Organization: VPG Integrated Media
Carl West wrote:
>
>
"Bourque, Jason" wrote:
>
>
>
> Hello,
>
>
>
> Does anyone have a vanilla handler that finds the next rounded value of a
>
> number, this is to be used in charts.
>
>
>
> i.e. 17.2 rounded would be 20
>
>
>
> 22.8 rounded would be 25
>
>
on round {theNumber, theNearest}
>
set theNumber to theNumber + (theNearest / 2)
>
return (theNumber - ((theNumber) mod theNearest))
>
end round
Oops, that was to round to the nearest. Rounding-up to the next would be:
on roundUp {theNumber, theNext}
set theNumber to theNumber + theNext
return theNumber - theNumber mod theNext
end roundUp
--
Carl West email@hidden
617.262.8830 x246
I have no superfluous leisure; my stay must be
stolen out of other affairs; but I will attend you awhile.
- Isabella, Measure for Measure, Act 3 Scene 1