Changeset 32544 in project


Ignore:
Timestamp:
07/05/15 13:00:12 (5 years ago)
Author:
sjamaan
Message:

numbers: Fix error reporting when supplied non-numeric arguments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/numbers/trunk/numbers.scm

    r32321 r32544  
    323323               (%/ numerator d)
    324324               (%make-ratnum numerator d))))
    325         (else (bad-number '+ y)) ) )
     325        (else (if (not (number? x))
     326                  (bad-number '+ x)
     327                  (bad-number '+ y))) ) )
    326328
    327329(define (- arg1 . args)
     
    367369               (%/ numerator d)
    368370               (%make-ratnum numerator d))))
    369         (else (bad-number '- y)) ) )
     371        (else (if (not (number? x))
     372                  (bad-number '- x)
     373                  (bad-number '- y))) ) )
    370374
    371375(define (* . args)
     
    375379            (args (##sys#slot args 1)))
    376380        (if (null? args)
    377             (if (number? x) x (bad-number '+ x))
     381            (if (number? x) x (bad-number '* x))
    378382            (let loop ((args (##sys#slot args 1))
    379383                       (x (%* x (##sys#slot args 0))))
     
    416420             (nonrat*rat y x)))
    417421        ((ratnum? y) (nonrat*rat x y))
    418         (else (bad-number '* x))))
     422        (else (if (not (number? x))
     423                  (bad-number '* x)
     424                  (bad-number '* y)))))
    419425
    420426(define-inline (bignum-digit-count b) (##core#inline "C_u_i_bignum_size" b))
     
    513519               (%ratnum num denom))))
    514520        ((not (number? x)) (bad-number '/ x))
    515         (else (bad-number '/ y))) )
     521        (else (if (not (number? x))
     522                  (bad-number '/ x)
     523                  (bad-number '/ y)))) )
    516524
    517525;; Burnikel-Ziegler recursive division: Split high number (x) in three
Note: See TracChangeset for help on using the changeset viewer.