CLHS says (22.3.3.2): "k is a scale factor that defaults to one (not zero)" ... "If k is zero, then d digits are printed after the decimal point, and a single zero digit appears before the decimal point if the total field width will permit it. If k is positive, then it must be strictly less than d+2; k significant digits are printed before the decimal point, and d-k+1 digits are printed after the decimal point. If k is negative, then it must be strictly greater than -d; a single zero digit appears before the decimal point if the total field width will permit it, and after the decimal point are printed first -k zeros and then d+k significant digits."
Here's what I get with ECL built today from Git (advertised version = 13.5.1).
> (loop for k in '(-2 -1 0 1 2) do (format t "~,4,,ve~%" k 1.23456789e-10)) 0.01235e-8 0.1235e-9 1.2346e-10 12.3457e-11 123.457e-12 NIL
From what I can tell, those are all wrong according to the CLHS description above. I think these (from SBCL 1.0.55.0) are correct:
* (loop for k in '(-2 -1 0 1 2) do (format t "~,4,,ve~%" k 1.23456789e-10)) 0.0012e-7 0.0123e-8 0.1235e-9 1.2346e-10 12.346e-11 NIL
Arto Bendiken
2014-09-23
Arto Bendiken
2014-09-23
I've confirmed that the behavior remains as described on Git HEAD as of revision 898a57818bea33119b1f5c53457f88e79f680fd3.
Bug #256 may be related.
jackdaniel
2015-02-25
jackdaniel
2015-05-06
jackdaniel
2015-05-06
Anonymous