|Aug 14, 2006, 12:39 PM||#1|
How to edit number precision in Applescript??
I have been learning Applescript recently and I can't figure out how to format the precision of a number. I have looked through forums and have looked through a couple of books as well as the Applescript Language Guide.
The "round" command comes close but isn't exactly what I need.
What I need in the end it to round numbers to the nearest two decimal places.
example : 18.094898203 to 18.09
Thanks for any help!
|Aug 14, 2006, 01:23 PM||#2|
(* format is roundThis(inDec, precision) *) roundThis(75.5436, 1) --this will round to 75.5 on roundThis(n, numDecimals) set x to 10 ^ numDecimals (((n * x) + 0.5) div 1) / x end roundThis
Obama is a true statesman whose experience as a state senator, half-term US Senator & guest lecturer in a Constitutional Law class has fully prepared him to take control of our nuclear arsenal.-Me
|Aug 15, 2006, 02:49 PM||#4|
Can't you just use a double variable?
Then again, I have not gone that in depth into applescript using numbers, that's where I just fall back to Java.
EDIT: Applescript doesn't support double types. Not suprised, but it's kind of an expected features, you know?
Last edited by SC68Cal; Aug 15, 2006 at 02:58 PM.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|Precision tools?||forza69||iPhone||3||Oct 30, 2013 01:12 AM|
|error number -1728 Applescript & some issues with spot||nellbern||Mac Programming||1||Jan 22, 2013 08:36 PM|
|atrun precision||elchemor||Mac Programming||2||Jan 2, 2013 11:49 PM|
|Edit Number on telephone app||hrv888||iPhone||3||Oct 31, 2012 09:00 PM|
|Creating a random number within a URL using Applescript||moorbull||Mac Programming||1||Jul 19, 2012 09:16 AM|
All times are GMT -5. The time now is 06:19 PM.