Re: Rounding x to y decimal places (was Re: Int Function
Re: Rounding x to y decimal places (was Re: Int Function
- Subject: Re: Rounding x to y decimal places (was Re: Int Function
- From: has <email@hidden>
- Date: Mon, 19 Aug 2002 14:15:48 +0100
Timothy Bates wrote:
>
But round doesn't do this...
>
It would be nice to have "decimal places" optional parameter [default = 0]
>
>
round pi decimal places 4
>
-->3.141
>
>
Rather than making our own functions ala
>
>
roundoff from pi into 4
>
>
to roundoff from x into y
>
set divvy to 10 ^ y
>
return (round (x * divvy)) / divvy
>
end roundup
Well, if you will use AS's labelled parameters then that's your own
comeuppance... some impressive linguistic gymnastics mind you.;) [1]
Just imagine if AS had a decent module-loading system though: we could set
Nigel loose for a week, and then you wouldn't ever need to worry about
rolling your own rounding code ever again; you'd just download and use one
of his, just as you do with osaxen today. [2]
IMO, folks are overly dependent on osax for solving their problems...
certainly they're convenient, but this may not be entirely healthy in the
long run.
Cheers,
has
[1] I'd use 'roundNumber(theReal, toDecimalPlaces)', no question.
[2] In this case, however, I'm pretty certain Nigel has written such a
rounding library already; as have I. Since we ain't wanting for the code
itself, I reckon it's the distribution/reuse mechanism that must be to
blame.
--
(My email address has changed from <email@hidden> to
<email@hidden>. Please update your address books accordingly.)
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.