Skip to content
Snippets Groups Projects
Commit ca2b87d5 authored by ram's avatar ram
Browse files

Changed RATIONAL to special-case 0 so that we don't spuriously create a 128 bit

bignum and then divide 0 by it.
parent ce47dbf3
No related branches found
No related tags found
No related merge requests found
......@@ -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)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment