Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ucla-cs!arman From: arman@CS.UCLA.EDU Newsgroups: comp.lang.prolog Subject: Arithmetic problems with Quintus Prolog Message-ID: <11111@shemp.CS.UCLA.EDU> Date: 11 Apr 88 04:51:10 GMT Sender: news@CS.UCLA.EDU Reply-To: arman@CS.UCLA.EDU (Arman Bostani) Organization: UCLA Computer Science Department Lines: 57 Please don't take this message as a flame against Quintus. I'd like to discuss some problems that I think Qprolog should address. Overall, though, Qprolog is one of the best prolog systems I have used. The following examples are taken from Quintus prolog release 2.2 running on a Sun-3, Unix 3.5. Firstly, Qprolog seems to maintain both 0 and -0. Here's what I mean: | ?- X is 0.0, Y is -X, X=Y. no This is a bug! Qprolog works fine though if you replace "0.0" with "0" in the above example. Also, the Qprolog lexical analyzer seems to be somewhat brain-damaged. For example: | ?- X is 1000000000. X = -73741824 I think that in this case the system should have either trapped with an arithmetic overflow, or it should have unified X with "Infinity" as C-Prolog does it. Granted "Infinity" is not a great solution, but it's better than random answers. Here is a misfeature that really bugged me. | ?- Op=..[+,2,2], X is Op. [ERROR: variable is not bound to a number: 2+2 (error 303)] [ERROR: invalid arithmetic expression: 2+2 (error 302)] no The Qprolog manual mentions this misfeature. The problem is that is/2 will not accept expressions that contain variables not bound to numbers. This is bad. It means that if I want a C-Prolog like is/2, I'll have to write my own! (note that is/2 works as expected with SICS prolog which is a Quintus look alike). I should also note that floating point numbers are not automatically coerced into integers. For example: | ?- 0 is 0.0. no This is a matter of taste I guess. I personally prefer the way that C-Prolog does it (i.e. when a floating point number fits in an integer, it is automatically converted) This can become a big performance issue if one is trying to do number crunching. (Most prologs chew everything very slowly anyway, just being polite I guess :-) -- Arman Bostani // UCLA Computer Science Department // +1 213-825-3194 3417 Boelter Hall // Los Angeles, California 90024-1596 // USA arman@CS.UCLA.EDU ...!(ucbvax,rutgers)!ucla-cs!arman