Format ~E rounding error?
Siebe <[email protected]>
| Newsgroups | gmane.lisp.steel-bank.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi List (and thinking of Christophe),
While random testing my own 'round-n-digits', I stumbled on the ~E format
as below.
Wouldn't "4.037241993e-1" be more appropriate? For what it's worth: my
local C library printf with "%.9e" also has "4.037241993e-01".
Bug report?
Bye,
Siebe
This is SBCL 2.5.9, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (let ((*read-default-float-format* 'double-float))
(format nil "~,VE" 9 0.40372419925d0))
"4.037241992e-1"
* (- 0.40372419925d0 4.037241992d-1)
5.000000413701855d-11
* (- 4.037241993d-1 0.40372419925d0)
4.999994862586732d-11
*