Re: Round Handler, care to share.
Re: Round Handler, care to share.
- Subject: Re: Round Handler, care to share.
- From: "Arthur J Knapp" <email@hidden>
- Date: Wed, 06 Dec 2000 16:49:57 -0500
>
From: "Bourque, Jason" <email@hidden>
>
Subject: Round Handler, care to share.
>
Date: Wed, 6 Dec 2000 15:35:23 -0500
>
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
??? What is your criterion for rounding, multiples of 5 ???
And if so, why does 22.8 round to 25 ? It is "closer" to 20.
Oh, perhaps you want to round up to the next multiple of 5?
on NextMultiple( num, multi )
set increment to multi
repeat until num < multi
set multi to multi + increment
end repeat
return multi
end NextMultiple
NextMultiple(17.2, 5)
--> 20
NextMultiple(22.8, 5)
--> 25
--
{
Arthur J Knapp, of STELLARViSIONs ;
http://www.STELLARViSIONs.com ;
mailto:email@hidden ;
http://developer.apple.com/techpubs/
macos8/InterproCom/AppleScriptScripters/
AppleScriptLangGuide/
}