Re: Round a number towards zero!
Re: Round a number towards zero!
- Subject: Re: Round a number towards zero!
- From: has <email@hidden>
- Date: Fri, 18 Mar 2005 17:42:46 +0000
Christian Vinaa wrote:
how do I then fx round to x decimals ?
AppleMods' Number library
<http://applemods.sourceforge.net/mods/Data/Number.php > provides a
collection of rounding and trimming commands, e.g.:
-- (library loading code omitted for clarity)
_Number's trimTowardZero(1000.1234, 2)
--> 1000.12
BTW, this library incorporates a fix for rounding errors in
AppleScript discovered by Emmanuel Levy, so should give more reliable
results than a naive solution.
If you've not used AppleMods' libraries before, you'll need to
download and install AppleMods' Loader system first
<http://applemods.sourceforge.net/getstarted.html>. Run the Loader
installer, then download and add the Number library to the
ASLibraries folder. You can use the LoaderWizard applet to generate
the library loading code to paste at the top of your script.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden