Re: computing 20! all the way
Re: computing 20! all the way
- Subject: Re: computing 20! all the way
- From: Doug McNutt <email@hidden>
- Date: Fri, 12 Nov 2004 09:09:53 -0700
At 17:37 +1100 11/12/04, Richard Morton wrote:
>
>on factorial from n
> if n = 0 then return 1
> return n * (factorial from (n - 1))
>end factorial
That recursion is a good example of a technique that is useful for such things as traversing a directory tree in AppleScript but it won't solve the underlying question of this thread which is that IEEE floating point doubles (64 bits) simply will not support more than approximately 15 decimal digits of precision. One needs type extended (80 bits) which AppleScript will not do and it won't take much above 20! to exceed even that.
Character based techniques, as suggested by others, for arbitrary precision are probably best for such things but they are slow.
--
--> If you are presented a number as a percentage, and you do not clearly understand the numerator and the denominator involved, you are surely being lied to. <--
_______________________________________________
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