[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
(SXHASH '(1 . 0))
- To: RIVEST at MIT-ML
- Subject: (SXHASH '(1 . 0))
- From: Guy.Steele at CMU-10A
- Date: Tue, 23 Jun 81 14:50:00 GMT
- Cc: bug-lisp at MIT-MC
- In-reply-to: RIVEST@MIT-ML's message of 23 Jun 81 00:15-EST
- Original-date: 23 June 1981 1050-EDT (Tuesday)
Ron,
There seems to be some confusion here. First of all,
the PDP-10 is a two's-complement machine, so the word
octal 400000000000 isn't -0, but -2^35. It's just as good
as any other integer. SXHASH returns integers in the range
[-2^35,2^35-1] (that is, those which fit into single PDP-10
words).
Now, indeed ABS of this number will overflow and fail,
*if* ABS somehow believes that it is not allowed to use bignums;
this should only happen in *compiled* code where the compiler
believes that it can open-code ABS. This could happen because
of a compiler bug, or because you declared (FIXSW T).
In the interpreter (REMAINDER (ABS (SXHASH '(1 . 0))) 5000.)
works fine. A bignum gets used for the result of ABS.
I suggest that you pursue this further to discover the problem.
However, another way to express the computation is
(ABS (REMAINDER (SXHASH '(1 . 0)) 5000.)), which does the
same thing because REMAINDER is symmetric about the origin
in its first argument.
--Guy