Rounding x to y decimal places (was Re: Int Function
Rounding x to y decimal places (was Re: Int Function
- Subject: Rounding x to y decimal places (was Re: Int Function
- From: Timothy Bates <email@hidden>
- Date: Mon, 19 Aug 2002 13:58:22 +1000
>
From: Christopher Nebel <email@hidden>
>
I tend to prefer "round" because it makes the intent more clear, and
>
it's more flexible -- you can use different rounding modes without
>
adding a lot of code that doesn't come naturally to non-numerics folk.
>
(Consider how many times people here have asked how to round a number
>
to n decimal places.)
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
_______________________________________________
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.