From 3ae4e00806766247babe0a702b64e5518c18dd1e Mon Sep 17 00:00:00 2001 From: rtoy <rtoy> Date: Wed, 9 Jun 2004 14:46:11 +0000 Subject: [PATCH] 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. --- code/float.lisp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/code/float.lisp b/code/float.lisp index a9d2d0ff0..c41b612b3 100644 --- a/code/float.lisp +++ b/code/float.lisp @@ -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.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. ;; Infinity or NaN. x) ((<= biased 0) - ;; Number is less than 1 - 0f0) + ;; Number is less than 1. IEEE 754 says it should have the + ;; same sign. Make it so. + (* x 0f0)) ((>= biased (float-digits x)) ;; Number is an integer x) @@ -1125,8 +1126,9 @@ rounding modes & do ieee round-to-integer. (cond ((= exp vm:double-float-normal-exponent-max) x) ((<= biased 0) - ;; Number is less than 1 - 0d0) + ;; Number is less than 1. IEEE 754 says it should have the + ;; same sign. Make it so. + (* x 0d0)) ((>= biased (float-digits x)) ;; Number is an integer x) -- GitLab