Guile Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bignum arithmetics
> From: Mikael Djurfeldt <firstname.lastname@example.org>
> Aleksandar Bakic <email@example.com> writes:
> > I ran a function to compute factorial of 10000 in Guile, and got a
> > result that did not end with a zero (it had a bunch of zeros in the
> > middle, but had about a dozen of non-zero digits in the end). What
> > could be the reason?
> At any rate, I don't think it's likely that this is a Guile bug.
> How does your program look like?
Did you try it? I used the following program.
(define (fact n)
(let mul ((k 1)(p 1))
(if (> k n) p (mul (+ k 1)(* k p)))))
after testing with (fact 4) and (fact 5), I tried
(fact 10000) and got something ending in
~/downloads$ls -l `which guile`
-rwxr-xr-x 1 root root 14412 Jul 14 21:25 /usr/local/bin/guile
So I am using a rather old version.
I remember a discussion of exactly this bug a year or two ago,
with embarassingly long thread devoted to the question of
whether the result _should_ end in zeroes (trust me, it should).
I think somebody had claimed to have fixed it, and that I
believed them at the time. The problem had to do with an out
of storage condition that was ignored, so if you have too
much RAM maybe it doesn't happen until the number gets
even bigger. (I have 16M)
This mail message sent by GNU emacs and Linux.
Food, Shelter, Source code.
Guile Home |
Main Index |