Skip to content
Snippets Groups Projects
Commit 51a50f19 authored by rtoy's avatar rtoy
Browse files

Trac ticket #10

For large numbers we did not check for odd-valued results that needed
to be rounded to even.
parent 6574f257
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float.lisp,v 1.35 2007/03/27 16:57:43 rtoy Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float.lisp,v 1.36 2007/05/19 01:35:46 rtoy Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -1200,6 +1200,7 @@ rounding modes & do ieee round-to-integer.
(integer-decode-float number)
(let* ((shifted (ash bits exp))
(rounded (if (and (minusp exp)
(oddp shifted)
(not (zerop (logand bits
(ash 1 (- -1 exp))))))
(1+ shifted)
......@@ -1210,16 +1211,17 @@ rounding modes & do ieee round-to-integer.
#+double-double
((double-double-float)
(multiple-value-bind (bits exp)
(integer-decode-float number)
(let* ((shifted (ash bits exp))
(rounded (if (and (minusp exp)
(not (zerop (logand bits
(ash 1 (- -1 exp))))))
(1+ shifted)
shifted)))
(if (minusp number)
(- rounded)
rounded))))))
(integer-decode-float number)
(let* ((shifted (ash bits exp))
(rounded (if (and (minusp exp)
(oddp shifted)
(not (zerop (logand bits
(ash 1 (- -1 exp))))))
(1+ shifted)
shifted)))
(if (minusp number)
(- rounded)
rounded))))))
(declaim (maybe-inline %unary-ftruncate/single-float
%unary-ftruncate/double-float))
......
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