# One bug in CMUCL (version 15a?)

```Paul -

Thanks for your prompt response.  I think that this is a hard problem,
but I do think it is soluble, and that the current CMU CL
implementation doesn't have it yet.  More below.

From: Paul_Gleichauf@B.GP.CS.CMU.EDU
Date: Thu, 23 Apr 92 16:12:26 -0400

Jonathan,
I have examined the format behavior that you have reported
as a bug:

> * (format nil "~16,9,2E" -9.9999999999d0)

> "-10.000000000e+00"
> * (length *)

> 17

As you have noted the rounding up of the 10 9's to the right of
the decimal point causes 9 0's in the returned printed
representation.  There are 9 places reserved in the format
directive. Pus one for the decimal point. There are two places
reserved for the the digits of the exponent, one for its sign,
another for the E. That's 14 so far. Now the leading minus sign
requires 1 place and the rounded 10 two more. That is 17 required
by the format directive.

There's nothing that requires that you print "the rounded 10".  Why
not print the following:

"-1.000000000e+01"
---9-----++4+

9 after the decimal point, 4 for the exponent, one for the sign and
one for the decimal point makes only 15.

I'd be happy to look at the source code if you could point me to it.
(I haven't untarred the source yet...)

I will refer you to Steele CLtL2 p.590.

Thanks for the reference.  My reading is that the definition is
somewhat ambiguous, but I'm confident that the above value can be
computed relatively easily, by rounding the original value to s
significant digits, where

s = w - ( (if negative then 1 else 0) + 1 + (e+2) )

(width of everything except the sign, decimal point, and exponent).

In any case, the value output is not valid, because you're only
allowed to strech d or e to output the value.  Consider the following
examples:

* (format nil "~16,9,2,0E" -9.9999999999d0)
"-1.000000000d+01"
;; should be " -.100000000d+02"
* (length *)
16
* (format nil "~17,9,2,0E" -9.9999999999d0)
" -1.000000000d+01"
;; should be "  -.100000000d+02"
* (length *)
17

In general bug reports should be sent to the address on the
banner when you start up CMU CL, i.e. cmucl-bugs@cs.cmu.edu and not
through our slisp-group internal mailing list.

You're right, the address is printed out when I start up the lisp.  My
apologies.

--- Jonathan

P.S.  Is a CLTL2 release planned soon?
```