users-prolog
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Iteratively calling Prolog from C


From: Daniele Peri
Subject: Re: Iteratively calling Prolog from C
Date: Thu, 17 Jul 2003 18:11:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Daniel Dudley wrote:

Using the top-level, I consulted factorial_nd.pl and then
ran the query:

    | ?- factorial(14,F).
    F = 205203456
    yes

Clearly an error will occur if N (the first argument) is
big. This is because, AFAIK, gprolog doesn't have a big
number library. Indeed,

    | ?- factorial(15,F).
    F = -143173632
    yes

Daniel

Such little N doesn't really help testing the recursion optimization. As I told you before you may want to turn the factorial into a sum of integers (not very important) and try with a N large enough (important).
The representation error you are talking about is a different subject.

Daniele





reply via email to

[Prev in Thread] Current Thread [Next in Thread]