Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!think.com!hsdndev!husc6!popvax!rind From: rind@popvax.uucp (747707@d.rind) Newsgroups: comp.lang.pascal Subject: Re: Is this not a bug? Message-ID: <5777@husc6.harvard.edu> Date: 21 Feb 91 13:32:05 GMT References: <1991Feb20.170152.5401@ux1.cso.uiuc.edu> Sender: news@husc6.harvard.edu Organization: Health Sciences Computing Facility, Harvard University Lines: 22 In article <1991Feb20.170152.5401@ux1.cso.uiuc.edu> mead@uxh.cso.uiuc.edu (Alan David Mead) writes: >I finally tracked down a problem with an application writen in >TP5.5: Since my values are all positive, I used words instead of >integers. The ABS() function, however, does not operate as (I) >expected with word parameters. This code demonstrates. While I >can imagine how the value is produced by ABS(), I think the manual's >description is deceptive. What does the net think? [Code deleted.] I don't see this as a bug. It's not ABS that's not functioning as you expect. Any other function would have behaved the same way. When you took the difference of two WORD variables inside a function call, the result was a WORD. Since a WORD is unsigned, it could never go negative, and so the difference had to be a number between 0 and 65535. The function call ABS(w2-w1) is equivalent to creating a third word variable w3 and doing w3 := w2-w1 followed by ABS(w3). I can't see the point in ever taking the absolute value of a WORD type variable, but perhaps someone else has some thoughts on this. David Rind rind@popvax.harvard.edu