5.3 printShowingDecimalPlaces: 2 displays '5.29' insteadof'5.30'
ncellier at ifrance.com
Sat Nov 24 00:23:51 UTC 2007
Obviously, this method is weak!
Main thing is to check mantis http://bugs.squeak.org/
If not reported, please open a bug report.
If you have time, create a SUnit TestCase, file it out and upload test
on bug report.
Even better, create and upload a patch.
This time, it is already there http://bugs.squeak.org/view.php?id=5640
If the patch rocks, you review it carefully, and propose it as candidate
for image integration at http://wiki.squeak.org/squeak/5934
Sebastian Sastre a écrit :
> Besides that, I think that #printShowingDecimalPlaces: needs a serius fix.
> Evaluating for this float:
> 302.46 printShowingDecimalPlaces: 2
> Result displaying it is '302.45'
> We calculate quite well by using fractions and scaled decimals but we also
> need good text representations of those fine values.
> Any known patch for that?
> Sebastian Sastre
>> -----Mensaje original-----
>> De: squeak-dev-bounces at lists.squeakfoundation.org
>> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] En
>> nombre de nicolas cellier
>> Enviado el: Jueves, 22 de Noviembre de 2007 19:52
>> Para: squeak-dev at lists.squeakfoundation.org
>> Asunto: Re: 5.3 printShowingDecimalPlaces: 2 displays '5.29'
>> You're welcome,
>> and to push library polishing and consistency further, I
>> propose that (ScaledDecimal readFrom: '5.30') behave as you expect.
>> Try patch at http://bugs.squeak.org/view.php?id=6779
>> Sebastian Sastre a écrit :
>>>> And if it prints 5.29s2, then it is because of
>>>> http://bugs.squeak.org/view.php?id=5693 that you did not
>> care to read.
>>> Hey! I was reading that. That's why I'm now converting values to
>>> scaled decimals without even passing the string
>> representation entered
>>> in the widget to number conversion through floats!
>>>> * 5.3 asTrueFraction < (53/10)
>>>> * ScaledDecimal use truncated print,
>>>> => you have the explanation.
>>>> The only thing you should try if you cannot get read of
>> Float because
>>>> of 3rd party code is:
>>>> (5.3 asScaledDecimal: 2) roundTo: 0.01s2.
>>> Thanks for helping so accurately,
More information about the Squeak-dev