[movitz-cvs] CVS movitz/losp/muerte

ffjeld ffjeld at common-lisp.net
Tue Nov 7 12:16:59 UTC 2006


Update of /project/movitz/cvsroot/movitz/losp/muerte
In directory clnet:/tmp/cvs-serv3438

Modified Files:
	format.lisp 
Log Message:
When printing the last digit in format-float, use (floor (+ 1/2 x)) rather
than (round x), because round rounds towards the nearest _even_ integer.
See (bottom of CLHS entry for round et al).


--- /project/movitz/cvsroot/movitz/losp/muerte/format.lisp	2006/04/05 23:02:22	1.13
+++ /project/movitz/cvsroot/movitz/losp/muerte/format.lisp	2006/11/07 12:16:59	1.14
@@ -10,7 +10,7 @@
 ;;;; Author:        Frode Vatvedt Fjeld <frodef at acm.org>
 ;;;; Created at:    Sat Mar 23 01:18:36 2002
 ;;;;                
-;;;; $Id: format.lisp,v 1.13 2006/04/05 23:02:22 ffjeld Exp $
+;;;; $Id: format.lisp,v 1.14 2006/11/07 12:16:59 ffjeld Exp $
 ;;;;                
 ;;;;------------------------------------------------------------------
 
@@ -82,7 +82,7 @@
 	  (declare (index i))
 	  (multiple-value-bind (next-digit next-remainder)
 	      (if (= i last-i)
-		  (round (* 10 remainder))
+		  (floor (+ 1/2 (* 10 remainder)))
 		(truncate (* 10 remainder)))
 	    (setf remainder next-remainder)
 	    (write-digit next-digit *standard-output*)))))))




More information about the Movitz-cvs mailing list