[squeak-dev] Re: BUG Squeak 3.7 - Number>>printShowingDecimalPlaces:

nicolas cellier ncellier at ifrance.com
Thu Nov 6 21:06:07 UTC 2008


David T. Lewis a écrit :
> On Wed, Nov 05, 2008 at 07:31:53PM +0100, Patrick.Chenais at bit.admin.ch wrote:
>> (I sent this message 2.11.2008, but I'm not sure it has been published. Let's try again.)
>>
>> 1.189159413903272e3 printShowingDecimalPlaces: 2  '1189.16'
>> 1.189159413903272e4 printShowingDecimalPlaces: 2  '11891.59'
>> 1.189159413903272e5 printShowingDecimalPlaces: 2 '118915.94'
>> 1.189159413903272e6 printShowingDecimalPlaces: 2 '1.18' BUG !!!
> 
> Hi Patrick,
> 
> There are several issues on Mantis (bugs.squeak.org) that relate
> to #printShowingDecimalPlaces:, one if which must have addressed
> this bug (it is fixed in Squeak 3.9 and 3.10 at least). If you have
> follow up issues, it would be good to report them on Mantis. If you
> are using an older 3.7 image, you may need to locate the relevant
> patch and apply it your own image.
> 
> Dave
> 

Unfortunately, as you can see in:

See http://bugs.squeak.org/view.php?id=7028
printShowingDecimalPlaces: is broken in 3.10

changes harvested in 3.9/3.10 were not fully correct.
You need to pick the last changes from:

http://bugs.squeak.org/view.php?id=5640
additional tests and fixes for Number>>printShowingDecimalPlaces:

Only current Pharo and future Squeak 3.11 should be correct.

-------------------------------------------------------------------

I can propose an additional list of fixes for 3.7/3.8 concerning Number 
conversions and rounding: some might help converting better.

http://bugs.squeak.org/view.php?id=3133
[BUG][FIX] Float>>#asIEEE32BitWord and #fromIEEE32Bit:

http://bugs.squeak.org/view.php?id=3373
Float asFraction does not handle gradual underflow

http://bugs.squeak.org/view.php?id=3504
Float asInteger conversion is inexact...

http://bugs.squeak.org/view.php?id=3564
LargeInteger>>asFloat does not honour IEEE rounding mode

http://bugs.squeak.org/view.php?id=3568
[FIX] Fraction>>asFloat does not answer nearest floating point number

http://bugs.squeak.org/view.php?id=6990
0.0 significandAsInteger is too big

http://bugs.squeak.org/view.php?id=7134
Float rounded is inexact

-------------------------------------------------------------------

And don't forget, Float are not parsed "exactly" by
Number class>>readFrom: because of chained inexact operations.
It won't answer the nearest Float to the entered decimal number.
Search for SqNumberParser on mantis for how to do it.
There is a message for printing Float "exactly" that works quite well.

I am on a computer without a mouse, so checking its name in squeak is 
not an option: i let you do it.

Nicolas




More information about the Squeak-dev mailing list