From ca2b87d5f69e85cf7f8aab05416a9ca16c41f491 Mon Sep 17 00:00:00 2001
From: ram <ram>
Date: Sat, 7 Jul 1990 13:44:33 +0000
Subject: [PATCH] Changed RATIONAL to special-case 0 so that we don't
 spuriously create a 128 bit bignum and then divide 0 by it.

---
 code/numbers.lisp | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/code/numbers.lisp b/code/numbers.lisp
index 75630b776..de76aa8fb 100644
--- a/code/numbers.lisp
+++ b/code/numbers.lisp
@@ -7,7 +7,7 @@
 ;;; Scott Fahlman (FAHLMAN@CMUC). 
 ;;; **********************************************************************
 ;;;
-;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.5 1990/07/07 13:30:50 ram Exp $
+;;; $Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.6 1990/07/07 13:44:33 ram Exp $
 ;;;
 ;;; This file contains the definitions of most number functions.
 ;;;
@@ -1452,12 +1452,14 @@
     (((foreach single-float double-float))
      (multiple-value-bind (bits exp)
 			  (integer-decode-float x)
-       (let* ((int (if (minusp x) (- bits) bits))
-	      (digits (float-digits x))
-	      (ex (+ exp digits)))
-	 (if (minusp ex)
-	     (integer-/-integer int (ash 1 (+ digits (- ex))))
-	     (integer-/-integer (ash int ex) (ash 1 digits))))))
+       (if (eql bits 0)
+	   0
+	   (let* ((int (if (minusp x) (- bits) bits))
+		  (digits (float-digits x))
+		  (ex (+ exp digits)))
+	     (if (minusp ex)
+		 (integer-/-integer int (ash 1 (+ digits (- ex))))
+		 (integer-/-integer (ash int ex) (ash 1 digits)))))))
     ((rational) x)))
 
 
-- 
GitLab