[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bignum bug?
- To: FH at MIT-MC
- Subject: Bignum bug?
- From: JONL at MIT-MC (Jon L White)
- Date: Mon, 22 Sep 80 17:22:00 GMT
- Cc: (BUG LISP) at MIT-MC
- Original-date: 22 SEP 1980 1322-EDT
Date: 21 September 1980 20:44-EDT
From: Fred W. Helenius <FH at MIT-MC>
If you compile the following function (which is intended to add two
. . .
(defun add-rats (a b)
(let (((c . d) a)
((e . f) b))
(let ((hcf (gcd d f)))
(cons (plus (times c (quotient f hcf))
(times e (quotient d hcf)))
(times (quotient d hcf) f)))))
(setq exp
'(apply 'add-rats '((716087101460491 . 1041496283283456)
(103334765625 . 197568495616))))
. . .
I suppose this is a bug. The function works fine in the interpreter,
and compiled for most arguments. For your convenience, the function
definition, the result of its compilation, and the definition of exp
may be found in FH;BUG DEFN, BUG FASL, and BUG EXP, respectively.
I took the liberty of changing your BUG EXP file so that the bug would be
visible in LISP as well as MACSYMA (i.e., I added the necessary decimal
point after the numbers). This result is actually due to a bug in LISP,
and I've just patched it (GCD was clobbering a random register).