[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Issue: FORMAT-E-EXPONENT-SIGN (Version 2)
- To: email@example.com
- Subject: Issue: FORMAT-E-EXPONENT-SIGN (Version 2)
- From: masinter.pa@Xerox.COM
- Date: 2 Oct 88 13:10 PDT
In addition to changing the issue name, I changed the Proposal wording so
that it read as a change to Common Lisp rather than a change to CLtL.
I think this is ready for release. NAK's only, please.
References: CLtL pp. 366, 393
Edit history: Bob Cassels, 13 Sep 88
Masinter, 2-Oct-88 (change issue name)
Related issues: <none>
The result of (format nil "~E" 1.0) is specified in a contradictory
The ambiguity is whether a plus sign should be printed in front of
The top of page 393 says, "Next, either a plus or a minus sign is
printed, followed by e digits ... [decimal exponent]"
Later on page 393 we see, "If all of w, d, and e are omitted, then the
effect is ... [like prin1].
Page 366 [presumably where prin1 is defined] doesn't explicitly say
the plus sign is omitted from the exponent, but all the examples (and
usual practice) indicate that.
So the posssibilities are:
The first reference implies that A is correct, the third reference
implies that B is correct. The second reference implies that A and B
are the same.
Specify that ~E always prints a plus or minus sign in front of the
This would cause the language on page 393 of CLtL to to change:
"If all of w, d, and e are omitted, then the effect is to print the
value using ordinary free-format exponential-notation output; PRIN1
a similar format for any non-zero number whose magnitude is less than
10**-3 or greater than or equal to 10**7. The only difference is that
the ~E directive always prints a plus or minus sign in front of the
exponent, while PRIN1 omits the plus sign if the exponent is
(format nil "~E" 1.0) => "1.0e+0"
This proposal makes ~E self-consistent. That is more important than
making ~E consistent with PRIN1.
Symbolics Common Lisp, Ibuki Lisp, and VAX Lisp all print the plus
sign as in the test case above. Apollo DOMAIN Common Lisp (version
2.10) and Xerox Common Lisp produce "1.0", which is wrong because
it includes no exponent at all.
Minimal changes to one printing routine for non-conforming
implementations. (No change to the three implementations mentioned
Cost of non-adoption:
Minor confusion and possible incompatibility among implementations.
Less confusion, more compatibility.
Minimal. It is doubtful that any user programs depend on this
A matter of opinion.
Fortran ~E format requires a sign before the exponent, since the
mark character may be dropped. Since Common Lisp ~E always prints
the exponent marker, the exponent sign may be dropped in the case
that it would be a plus sign.