Signal an error for (/ 1/2 0).
authorChris Hanson <org/chris-hanson/cph>
Mon, 1 Feb 1993 01:31:05 +0000 (01:31 +0000)
committerChris Hanson <org/chris-hanson/cph>
Mon, 1 Feb 1993 01:31:05 +0000 (01:31 +0000)
v7/src/runtime/arith.scm

index beaf09de7d684873df837ea62b752b729e8437ff..ff8746420296ed9d2f6fde3a344a06ad6ed8afce 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: arith.scm,v 1.25 1992/09/21 19:06:40 cph Exp $
+$Id: arith.scm,v 1.26 1993/02/01 01:31:05 cph Exp $
 
 Copyright (c) 1989-1992 Massachusetts Institute of Technology
 
@@ -529,7 +529,7 @@ MIT in each case. |#
   (rat:binary-operator u/u* v/v*
     (lambda (u v)
       (if (int:zero? v)
-         (error:divide-by-zero '/ (list u v))
+         (error:divide-by-zero '/ (list u/u* v/v*))
          (rat:sign-correction u v
            (lambda (u v)
              (let ((d (int:gcd u v)))
@@ -542,11 +542,13 @@ MIT in each case. |#
            (make-rational (int:* (int:quotient u d) v*)
                           (int:quotient v d))))))
     (lambda (u u* v)
-      (rat:sign-correction u v
-       (lambda (u v)
-         (let ((d (int:gcd u v)))
-           (make-rational (int:quotient u d)
-                          (int:* u* (int:quotient v d)))))))
+      (if (int:zero? v)
+         (error:divide-by-zero '/ (list u/u* v/v*))
+         (rat:sign-correction u v
+           (lambda (u v)
+             (let ((d (int:gcd u v)))
+               (make-rational (int:quotient u d)
+                              (int:* u* (int:quotient v d))))))))
     (lambda (u u* v v*)
       (let ((d1 (int:gcd u v))
            (d2