From ffjeld at common-lisp.net Tue Nov 7 12:16:59 2006 From: ffjeld at common-lisp.net (ffjeld) Date: Tue, 7 Nov 2006 07:16:59 -0500 (EST) Subject: [movitz-cvs] CVS movitz/losp/muerte Message-ID: <20061107121659.D681B4717E@common-lisp.net> 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 ;;;; 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*))))))) From ffjeld at common-lisp.net Wed Nov 8 08:57:05 2006 From: ffjeld at common-lisp.net (ffjeld) Date: Wed, 8 Nov 2006 03:57:05 -0500 (EST) Subject: [movitz-cvs] CVS movitz Message-ID: <20061108085705.A948463045@common-lisp.net> Update of /project/movitz/cvsroot/movitz In directory clnet:/tmp/cvs-serv1708 Modified Files: compiler-types.lisp Log Message: Teach compiler about the ratio type. --- /project/movitz/cvsroot/movitz/compiler-types.lisp 2005/08/21 23:29:44 1.25 +++ /project/movitz/cvsroot/movitz/compiler-types.lisp 2006/11/08 08:57:05 1.26 @@ -10,7 +10,7 @@ ;;;; Author: Frode Vatvedt Fjeld ;;;; Created at: Wed Sep 10 00:40:07 2003 ;;;; -;;;; $Id: compiler-types.lisp,v 1.25 2005/08/21 23:29:44 ffjeld Exp $ +;;;; $Id: compiler-types.lisp,v 1.26 2006/11/08 08:57:05 ffjeld Exp $ ;;;; ;;;;------------------------------------------------------------------ @@ -233,7 +233,7 @@ ;;; (defparameter *tb-bitmap* - '(hash-table character function cons keyword symbol vector array integer :tail) + '(hash-table character function cons keyword symbol vector array integer ratio :tail) "The union of these types must be t.") (defun basic-typep (x type) @@ -255,7 +255,9 @@ (fixnum (typep x 'movitz-fixnum)) (bignum - (typep x 'movitz-bignum)))) + (typep x 'movitz-bignum)) + (ratio + (typep x 'movitz-ratio)))) (defun type-code (first-type &rest types) "Find the code (a bitmap) for (or , at types)." @@ -364,7 +366,7 @@ (or (type-code-p 'integer code) (and integer-range (numscope-memberp integer-range (movitz-bignum-value x))))) - (t (dolist (bt '(symbol character function cons hash-table vector) + (t (dolist (bt '(symbol character function cons hash-table vector ratio) (error "Cant decide typep for ~S." x)) (when (basic-typep x bt) (return (type-code-p bt code))))))