Changes to Trunk (
http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2012-May/005343.htmlName: KernelTests-nice.220
Ancestors: KernelTests-nice.219
Change this test (-0.001 printShowingDecimalPlaces: 2) = '-0.00' instead of '0.00' to reflect Kernel-nice.690 feature.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2012-May/005344.htmlName: Kernel-nice.690
Ancestors: Kernel-nice.689
1) Correct the very new #printOn:maxDecimalPlaces: which often rounds inexactly for large Float or large number of digits.
Rationale: the printed representation shall be rounded exactly
2) Don't print arbitrary digits beyond Float precision, just print zeros
(0.1 printShowingDecimalPlaces: 20) now prints '0.10000000000000000000' instead of '0.10000000000000000555',
Rationale: those digits, while reflecting internal representation exactly, are totally insignificant and could be replaced with any other digits, while still representing the same Float.
3) Print the negative sign, even if the number vanishes to zero at prescribed decimal places
(-0.001 printShowingDecimalPlaces: 2) now prints '-0.00' instead of '0.00',
Rationale: this behaves like classical lib printf, and is in the spirit of Float negativeZero printString: when the precision vanishes, the Float keeps its sign.
Note: I find the scheme feature which prints # for insignificant digits is very nice, but we should find a re-interpretable format...
Implementation details:
Of course, algorithms are taken from:
Robert G. Burger and R. Kent Dybvig
Printing Floating Point Numbers Quickly and Accurately
ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation
June 1996.
Note that there is lot of duplicated code between free format and fixed format Float printing.
And we should also fix the case of fixed number of digits #absPrintOn:base:digitCount: ...
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2012-May/005345.htmlName: Kernel-nice.691
Ancestors: Kernel-eem.690, Kernel-nice.690
Grace period is over, publish and merge the changes for printing Floating point with fixed precision.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2012-May/005346.htmlName: KernelTests-nice.221
Ancestors: KernelTests-nice.220
Now that Float print exactly, avoid using low level private implementation #absPrintExactlyOn:base: in tests.
We might deprecate it in the future.
=============================================