111.2 printShowingDecimalPlaces: 2 -> '111.20'
111111111111111 printShowingDecimalPlaces: 2 -> '1.11' 123e20 printShowingDecimalPlaces: 2 -> '1.23' 10 printShowingDecimalPlaces: 20 -> Error: subscript is out of bounds: 21
Pavel
I've copied this report to Mantis. How about we try continuing discussion on this bug there? This is part of an experiment to try to work out how to work with Mantis and transition from the current situation.
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.
squeak-dev@lists.squeakfoundation.org