unpretty FORMAT ~E printing
Reported by
Nikodemus Siivola
on 20111029
This bug affects 1 person
Affects  Status  Importance  Assigned to  Milestone  

 SBCL 
Low

Unassigned 
Bug Description
Eric Marsden <email address hidden> via lists.sourcefor
Hi,
,
 * (lispimplement
 "1.0.50.545abf3b4"
 * (FORMAT NIL "~E" 1.0)
 "1.e+0"
 * (FORMAT NIL "~E" 1.0d0)
 "1.d+0"
`
My reading of CLHS ("If all of w, d, and e are omitted, then the effect
is to print the value using ordinary freeformat exponential
output") suggests that those should be "1.0e+0" and "1.0d+0".
http://
Alexnader Klimov says:
Unless "ordinary" is defined (I cannot find such a definition in the
specification), it is reasonable to understand "ordinary" as the form
without any redundant characters, that is for fixedformat it is "1.0"
(the zero is required since "1." is an integer), but for the
exponential notation "1.e+0" is sufficient (actually, "1.e0" is also
enough, but "+" is explicitly required).
As a hint that "1.e+0" is a better interpretation of Section 22.3.3.2
we can consider
If the parameter d is omitted, then there is no constraint on the
number of digits to appear. A value is chosen for d in such a way
that as many digits as possible may be printed subject to the width
constraint imposed by the parameter w, the constraint of the scale
factor k, and the constraint that no trailing zero digits may appear
in the fraction, except that if the fraction to be printed is zero
then a single zero digit should appear after the decimal point.
and thus "1.0e+0" would violate the "no trailing zero digits"
requirement.