anjo@swi.psy.uva.nl (Anjo Anjewierden) (11/08/90)
Richard A. O'Keefe writes: > Answer: we have a number with 9 decimal digits. I am aware of Prolog > systems with 14-bit, 16-bit, 17-bit, 18-bit, 20-bit, 24-bit, 28-bit, > 29-bit, and 32-bit integer arithmetic, as well as logical arithmetic > (by which I mean arithmetic with no stupid bit bound). How large can > an integer with 9 distinct decimal digits get? > 987654321 > How many bits does this need? > 30 > Will that _work_ in the Prolog systems I was using at the time? > a certain Prolog interpreter on a Sun-3/50 : NO > a certain Prolog compiler on a Sun-3/50 : NO > a certain Prolog compiler on a PC : NO > another Prolog compiler on a PC : NO > So _could_ I have used Anjewierden's method? > No. > > Recite after me: "not every Prolog system provides 32-bit integers". Doesn't the last sentence follow *logically* (if worded appropriately) from the previous sentences? A positive reading of my message is: apparently there is nothing wrong with the programs up to page 126. I agree the considerations above are reasonable from a practical point of view. To avoid confusion, it is a good idea to state why a number is represented as a list of digits. I'm about to conclude every program in ``The Craft of Prolog'' will run on Prolog implementations with 14-bit integer arithmetic. Is this right? :- Anjo, !.
ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) (11/09/90)
In article <4492@swi.swi.psy.uva.nl>, anjo@swi.psy.uva.nl (Anjo Anjewierden) writes: > I'm about to conclude every program in ``The Craft of Prolog'' will > run on Prolog implementations with 14-bit integer arithmetic. Is > this right? Probably not. The Prolog system I used with 14-bit integers was PDP-11 Prolog, and if I remember correctly that didn't include a sign bit. (Which is why library(long) exists. I had "improved" a program to do some clever things with arithmetic, and it was easier to implement bignums than to figure out how the program _used_ to work.) Another reason for doubting this is that I have been sent some errata; if there's any interest I could collate and post them. -- The problem about real life is that moving one's knight to QB3 may always be replied to with a lob across the net. --Alasdair Macintyre.