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 17:15:09 +0200

Daniel Dudley wrote:
> Daniel Dudley wrote:
> > Daniele Peri wrote:
> > > 
> > > You have a very simple way to get rid of your doubts: try
> > > it yourself. In general, this helps a lot.
> > 
> > I sure would if someone would provide me with a binary
> > version for Windows 2000. I don't have the time to compile
> > the sources myself. :-(
> 
> I forgot that this is now provided in the download.
> 
> 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

It would appear that gprolog does have something seriously
wrong with its implementation. :-(

    Win-Prolog 4.320           ECLiPsE 5.6
    (no big number library)    (has big number library)
    -----------------------    ------------------------
    ?- factorial(17,F).        ?- factorial(17, F).
    F = 355687428096000        F = 355687428096000
                               Yes (0.00s cpu)

    ?- factorial(18,F).        ?- factorial(18, F).
    F = 6.402373705728E015     F = 6402373705728000
                               Yes (0.00s cpu)

    GNU Prolog
    ----------
    ?- factorial(17,F).
    F = 248348672
    yes

    ?- factorial(18,F).
    F = 175308800
    yes

Daniel




reply via email to

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