Re: Crunch numbers
Re: Crunch numbers
- Subject: Re: Crunch numbers
- From: Nigel Garvey <email@hidden>
- Date: Thu, 14 Mar 2002 23:22:59 +0000
Andy Wylie wrote on Thu, 14 Mar 2002 21:48:32 +1300:
>
on 14/3/02 9:02 AM, Deivy Petrescu at email@hidden wrote:
>
>
>(round (z * (10 ^ numdigits)) rounding as taught in school) * (10 ^
>
numdigits)
>
>div (10 ^ n) / (10 ^ numdigits)
>
>
>
no good system 8.6, any ideas?
(* Truncate n to d decimal places, with or without rounding. *)
on trnc from n onto d given rounding:rounding
tell 10 ^ d
tell n * it
if rounding then
it div 0.5 - it div 1
else
it div 1
end if
end tell
result / it -- ie. result / (10 ^ d)
end tell
end trnc
trnc from 123.456789 onto 1 with rounding
--> 123.5
NG
_______________________________________________
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.