[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bignum bug?

If you compile the following function (which is intended to add two
rational numbers given in the form (numerator . denominator)), load
it into LISP, and do (eval exp) where exp is given below, LISP produces
the error still further below:

(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.