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

Fix precision bug. On x87 builds, the precision was set to 64 bits

instead of 53 bits.  This causes the incorrect result (found by Paul):

(ffloor 1.1605184953130993d26 12622780800d0) ->

9.193841782573768d15
-8.05306368d8

The correct result should have a remainder of zero.

Force the precision to be 53 bits (double-float).
parent 67fc4ac5
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/float-trap.lisp,v 1.34 2009/01/05 22:26:26 rtoy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float-trap.lisp,v 1.35 2009/07/06 13:29:57 rtoy Rel $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -75,8 +75,11 @@ ...@@ -75,8 +75,11 @@
(logior (ash (logand #x3f new) 16) (logior (ash (logand #x3f new) 16)
(ash rc 10) (ash rc 10)
(logand #x3f (ash new -7)) (logand #x3f (ash new -7))
;; Set precision control to be 64-bit, always. ;; Set precision control to be 53-bit, always.
(ash 3 8)))) ;; (The compiler takes care of handling
;; single-float precision, and we don't support
;; long-floats.)
(ash 2 8))))
(setf (x87-floating-point-modes) x87-modes))) (setf (x87-floating-point-modes) x87-modes)))
) )
...@@ -104,7 +107,10 @@ ...@@ -104,7 +107,10 @@
(logior (ash (logand #x3f new-mode) 16) (logior (ash (logand #x3f new-mode) 16)
(ash rc 10) (ash rc 10)
(logand #x3f (ash new-mode -7)) (logand #x3f (ash new-mode -7))
;; Set precision control to be 64-bit, always. ;; Set precision control to be 64-bit, always. We
;; don't use the x87 registers with sse2, so this
;; is ok and would be the correct setting if we
;; ever support long-floats.
(ash 3 8)))) (ash 3 8))))
(setf (vm::sse2-floating-point-modes) new-mode) (setf (vm::sse2-floating-point-modes) new-mode)
(setf (vm::x87-floating-point-modes) x87-modes)) (setf (vm::x87-floating-point-modes) x87-modes))
......
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