[FIX][BUG] printShowingDecimalPlaces: ( unit test plus fix for Utilities class>>floatPrecisionFroDecimalPlaces )

lewis at mail.msen.com lewis at mail.msen.com
Fri Nov 26 16:23:08 UTC 2004


Adds a range check for Utilities>>floatPrcisionForDecimalPlaces: and a
default implementation that works when the parameter is out of range.

Implementation note:
I used #caseOf:otherwise: to implement this. The result is about 25%
slower than the original unchecked method. I got very slightly faster
performance by writing it with a bunch of #ifTrue: lines, but I think
the caseOf approach is slightly less ugly.

All other implementations that I tried (including #at:ifAbsent:, and
#on:do) were significantly slower, so I settled on #caseOf:otherwise:
for clarity and reasonable speed.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrintShowingDecimalPlacesFix-dtl.cs.gz
Type: application/octet-stream
Size: 751 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041126/a6a54323/PrintShowingDecimalPlacesFix-dtl.cs.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PrintShowingDecimalPlacesTest-dtl.cs.gz
Type: application/octet-stream
Size: 455 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20041126/a6a54323/PrintShowingDecimalPlacesTest-dtl.cs.obj


More information about the Squeak-dev mailing list