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

Make %unary-ftruncate preserve the sign of the arg, so -0.0 is

returned appropriately instead of +0.0.

This is to conform to IEEE754.
parent 8cbbd24d
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.lisp,v 1.28 2002/07/22 17:01:36 toy Exp $") "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/float.lisp,v 1.29 2004/06/09 14:46:11 rtoy Exp $")
;;; ;;;
;;; ********************************************************************** ;;; **********************************************************************
;;; ;;;
...@@ -1095,8 +1095,9 @@ rounding modes & do ieee round-to-integer. ...@@ -1095,8 +1095,9 @@ rounding modes & do ieee round-to-integer.
;; Infinity or NaN. ;; Infinity or NaN.
x) x)
((<= biased 0) ((<= biased 0)
;; Number is less than 1 ;; Number is less than 1. IEEE 754 says it should have the
0f0) ;; same sign. Make it so.
(* x 0f0))
((>= biased (float-digits x)) ((>= biased (float-digits x))
;; Number is an integer ;; Number is an integer
x) x)
...@@ -1125,8 +1126,9 @@ rounding modes & do ieee round-to-integer. ...@@ -1125,8 +1126,9 @@ rounding modes & do ieee round-to-integer.
(cond ((= exp vm:double-float-normal-exponent-max) (cond ((= exp vm:double-float-normal-exponent-max)
x) x)
((<= biased 0) ((<= biased 0)
;; Number is less than 1 ;; Number is less than 1. IEEE 754 says it should have the
0d0) ;; same sign. Make it so.
(* x 0d0))
((>= biased (float-digits x)) ((>= biased (float-digits x))
;; Number is an integer ;; Number is an integer
x) 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