From: Nikodemus Siivola Date: Thu, 13 Mar 2008 13:18:49 +0000 (+0000) Subject: 1.0.15.25: fix ~R for vigtillions X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=2a2e392928449850fb531af1191f83f61e736c97;p=sbcl.git 1.0.15.25: fix ~R for vigtillions * Off-by-one error in sb-format::format-print-cardinal-aux was preventing ~R from printing numbers between 10^63 and 10^66-1. Patch by Luis Oliveira. --- diff --git a/NEWS b/NEWS index 2aa14d3..a0ab05a 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,7 @@ changes in sbcl-1.0.16 relative to 1.0.15: * optimization: modular arithmetic for a particular requested width is implemented using a tagged representation unless a better representation is available. + * bug fix: ~R was broken for vigtillions. (thanks to Luis Oliveira) * bug fix: attempt to obtain *SCHEDULER-LOCK* recursively when unscheduling timer at the same time as another timer fires. * bug fix: don't reschedule timers for dead threads. diff --git a/src/code/target-format.lisp b/src/code/target-format.lisp index df74380..890b943 100644 --- a/src/code/target-format.lisp +++ b/src/code/target-format.lisp @@ -377,7 +377,7 @@ (defun format-print-cardinal-aux (stream n period err) (multiple-value-bind (beyond here) (truncate n 1000) - (unless (<= period 20) + (unless (<= period 21) (error "number too large to print in English: ~:D" err)) (unless (zerop beyond) (format-print-cardinal-aux stream beyond (1+ period) err)) diff --git a/tests/print.impure.lisp b/tests/print.impure.lisp index 608ce7f..4f1b3f5 100644 --- a/tests/print.impure.lisp +++ b/tests/print.impure.lisp @@ -427,4 +427,10 @@ (assert (equal x x2)) (assert (eq h2 (gethash x2 h2))))) +;;; an off-by-one error in the ~R format directive until 1.0.15.20 +;;; prevented printing cardinals and ordinals between (expt 10 63) and +;;; (1- (expt 10 66)) +(assert (string= (format nil "~R" (expt 10 63)) "one vigintillion")) +(assert (string= (format nil "~:R" (expt 10 63)) "one vigintillionth")) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index cb693cd..e342e7d 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.15.24" +"1.0.15.25"