Re: How can I round in applescript to 3 digits after a period?
Re: How can I round in applescript to 3 digits after a period?
- Subject: Re: How can I round in applescript to 3 digits after a period?
- From: Axel Luttgens <email@hidden>
- Date: Thu, 03 Jan 2008 12:21:49 +0100
On 3/01/08 11:34, Patrik B. wrote:
Hi,
This might sound silly but how do you round a real number in
applescript to 3
digits after the period?
I.e. 19.9898923978923892 should just be rounded to 19.989
Also 19.0909 should just be rounded to 19.989
Must be a typo here... ;-)
Did you mean 19.09?
Per what I understand rounding in applescript rounds to an integer so
is there
a different rounding method that I can use to round to three digits
after the
period?
A quick way, assuming you are interested in numerical values, not in
their string representation:
set R to 19.989892397892
(round (R * 1000) rounding down) / 1000
Of course this might need some adjustments, depending on your needs
(e.g. handling negative numbers, or large ones).
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden