fixed bugs in format when given inexact and complex arguments to ~d,

~b, ~x, and ~o.
This commit is contained in:
Abdulaziz Ghuloum 2009-04-06 16:52:11 +03:00
parent 0c96321f20
commit 4ca8b1add2
2 changed files with 8 additions and 17 deletions

View File

@ -693,15 +693,12 @@
(when (null? args) (when (null? args)
(die who "insufficient arguments")) (die who "insufficient arguments"))
(let ([a (car args)]) (let ([a (car args)])
(cond (unless (number? a) (die who "not a number" a))
[(or (fixnum? a) (bignum? a) (ratnum? a)) (unless (or (eqv? c #\d) (exact? a))
(void)] (die who
[(flonum? a) (format "inexact numbers cannot be \
(unless (eqv? c #\d) printed with ~~~a" c)
(die who a)))
(format "flonums cannot be printed with ~~~a" c)))]
[else
(die who "not a number" a)]))
(f (fxadd1 i) (cdr args))] (f (fxadd1 i) (cdr args))]
[else [else
(die who "invalid sequence character after ~" c)])))] (die who "invalid sequence character after ~" c)])))]
@ -731,13 +728,7 @@
=> =>
(lambda (x) (lambda (x)
(let ([a (car args)]) (let ([a (car args)])
(cond (display-to-port (number->string a (cdr x)) p))
[(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)]))
(f (fxadd1 i) (cdr args)))] (f (fxadd1 i) (cdr args)))]
[else (die who "BUG" c)])))] [else (die who "BUG" c)])))]
[else [else

View File

@ -1 +1 @@
1752 1753