1.0.15.25: fix ~R for vigtillions
authorNikodemus Siivola <nikodemus@random-state.net>
Thu, 13 Mar 2008 13:18:49 +0000 (13:18 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Thu, 13 Mar 2008 13:18:49 +0000 (13:18 +0000)
 * 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.

NEWS
src/code/target-format.lisp
tests/print.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 2aa14d3..a0ab05a 100644 (file)
--- 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.
index df74380..890b943 100644 (file)
 
 (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))
index 608ce7f..4f1b3f5 100644 (file)
     (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
index cb693cd..e342e7d 100644 (file)
@@ -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"