Skip to content
Snippets Groups Projects
Commit 6bc003ab authored by pw's avatar pw
Browse files

From Ray Toy:

src/numbers.lisp:
Handle comparisons with floating infinities correctly.
parent b9555b70
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain. ;;; Carnegie Mellon University, and has been placed in the public domain.
;;; ;;;
(ext:file-comment (ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.36 2001/03/04 20:12:39 pw Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/numbers.lisp,v 1.37 2001/04/10 22:35:09 pw Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -843,11 +843,15 @@ ...@@ -843,11 +843,15 @@
((double-float single-float) ((double-float single-float)
(,op x (coerce y 'double-float))) (,op x (coerce y 'double-float)))
(((foreach single-float double-float #+long-float long-float) rational) (((foreach single-float double-float #+long-float long-float) rational)
(if (eql y 0) ;; Comparing infinity against any rational produces the same
;; answer as comparing infinity against 0.
(if (float-infinity-p x)
(,op x (coerce 0 '(dispatch-type x))) (,op x (coerce 0 '(dispatch-type x)))
(,op (rational x) y))) (,op (rational x) y)))
(((foreach bignum fixnum ratio) float) (((foreach bignum fixnum ratio) float)
(,op x (rational y))))) (if (float-infinity-p y)
(,op (coerce 0 '(dispatch-type x)) y)
(,op x (rational y))))))
(defmacro two-arg-</> (name op ratio-arg1 ratio-arg2 &rest cases) (defmacro two-arg-</> (name op ratio-arg1 ratio-arg2 &rest cases)
......
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