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

Bignum bug?



Either COMPLR needs to know that GCD can cause C to be altered, or else 
the routine at BNLWFL shouldn't alter C.  BNLWFL gets called from GCDBG4+12

----
    Date: 21 SEP 1980 2044-EDT
    From: FH at MIT-MC (Fred W. Helenius)

    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))))

    ;(7577) NON-NUMERIC VALUE

    ;BKPT WRNG-TYPE-ARG

    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.