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: Daniel Dudley
Subject: Re: Iteratively calling Prolog from C
Date: Thu, 17 Jul 2003 18:19:46 +0200

Lindsey Spratt wrote:
> On Thursday, July 17, 2003, at 10:53  AM, Daniel Dudley wrote:
> > Yes, that's was my first impression, Lindsey. However, it
> > doesn't explain:
> >
> >     ?- factorial(12,F).
> >     F = -57869312
> >     yes
> >
> > A signed integer on a 32-bit platform is -2147483648 to
> > 2147483647. Compare this with Win-Prolog and ECLiPSe:
> >
> >     ?- factorial(12,F).
> >     F = 479001600
> >
> >     ?- factorial(12, F).
> >     F = 479001600
> >     Yes (0.00s cpu)
> 
> When I run the code I posted previously under gprolog I get:
> ?- factorial(12, F)
> Success
> F = 479001600.0
> 
> The change to float processing does seem to produce the
> correct results.

Yes, I don't doubt that. I also noted that you're using a
pure recursive algorithm.

But it doesn't explain the result of ?- factorial(12,F)
when doing integer processing, using the backtracking
algorithm (you might give it try with your one).

Daniel




reply via email to

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