[PPL-devel] [Xsb-development] Arithmetic evaluation bug in the CVS HEAD version of XSB

Terrance Swift tswift at cs.sunysb.edu
Sun Sep 23 20:57:08 CEST 2007


On Sun, 23 Sep 2007, Bart Demoen wrote:

>
> > Do you agree with me that the
> > behavior I indicated witnesses a (big) XSB bug?
>
> It is more of an inconsistency than a bug: XSB has chosen not to
> evaluate variables on the right side of is/2 - Quintus used to do the
> same. Long ago, I didn't understand that there are good reasons for
> this choice. Now I think that Prolog would be better of without this
> feature.
>

I'm interested in why you think this (especially as this is what we do
anyway :-)

> Terry, why does the following not work as a fix in the compiler ? At
> compile time, replace X is Y by
>
> 	(number(Y) ->
> 		   X = Y
> 	;
> 		   throw(appropriate error)
> 	)
> That would give consistent behaviour, no ? Even though not ISO.
> You don't have to do such a thing for </2 (and friends) because of the
> rest of XSB's compilation schema for arithmetic ... which has its more
> important problems of course:
>

This may be a good solution if we decide not to go the ISO way.

> | ?- -2147483648 < 2147483647 .
>
> ++Error[XSB]: [Runtime/C] Overflow in integer, returning MAX_INT
>
> no
> | ?- -2147483648 < 1 .
>
> ++Error[XSB]: [Runtime/C] Overflow in integer, returning MAX_INT
>
> yes
> | ?- -2 < 2147483647 .
>
> no
>
> All the above in XSB Version 3.0.1 (Sagres) of August 7, 2006
>

Unfortunately, it is still the same in 3.1 (unless you use 64-bit
compilation).

Terry



More information about the PPL-devel mailing list