Sam Ismail <dastar(a)ncal.verio.com> wrote:
AppleSoft would logically return a +1 for the above
statement rather than
a -1. Why the PET returns a -1 is beyond me. Couldn't they have added
one more machine instruction to strip off the sign bit?
No, because then it would return 32767, which is even worse.
Remember, in two's complement arithmetic, -1 is all ones. This means that
having predicates return -1 for true is actually useful if you want to use
the return value as a mask for boolean operations on bit fields.
In practice it doesn't really matter; anything non-zero is considered true.
You should really be doing arithmetic on boolean values anyhow. :-)
[Smiley because I've done it many times myself.]
Eric