From 4ca8b1add2fb70b3a9141d8f08c0544b77359022 Mon Sep 17 00:00:00 2001 From: Abdulaziz Ghuloum Date: Mon, 6 Apr 2009 16:52:11 +0300 Subject: [PATCH] fixed bugs in format when given inexact and complex arguments to ~d, ~b, ~x, and ~o. --- scheme/ikarus.writer.ss | 23 +++++++---------------- scheme/last-revision | 2 +- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/scheme/ikarus.writer.ss b/scheme/ikarus.writer.ss index 0aed44a..5a6ab5d 100644 --- a/scheme/ikarus.writer.ss +++ b/scheme/ikarus.writer.ss @@ -693,15 +693,12 @@ (when (null? args) (die who "insufficient arguments")) (let ([a (car args)]) - (cond - [(or (fixnum? a) (bignum? a) (ratnum? a)) - (void)] - [(flonum? a) - (unless (eqv? c #\d) - (die who - (format "flonums cannot be printed with ~~~a" c)))] - [else - (die who "not a number" a)])) + (unless (number? a) (die who "not a number" a)) + (unless (or (eqv? c #\d) (exact? a)) + (die who + (format "inexact numbers cannot be \ + printed with ~~~a" c) + a))) (f (fxadd1 i) (cdr args))] [else (die who "invalid sequence character after ~" c)])))] @@ -731,13 +728,7 @@ => (lambda (x) (let ([a (car args)]) - (cond - [(or (fixnum? a) (bignum? a) (ratnum? a)) - (display-to-port (number->string a (cdr x)) p)] - [(flonum? a) - (display-to-port (number->string a) p)] - [else - (die who "BUG: not a number" a)])) + (display-to-port (number->string a (cdr x)) p)) (f (fxadd1 i) (cdr args)))] [else (die who "BUG" c)])))] [else diff --git a/scheme/last-revision b/scheme/last-revision index ba47111..1dc3694 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1752 +1753