5.3 printShowingDecimalPlaces: 2 displays '5.29' insteadof'5.30'

Sebastian Sastre ssastre at seaswork.com
Fri Nov 23 21:06:54 UTC 2007


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?

	thanks,

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' 
> insteadof'5.30'
> 
> 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
> 
> Nicolas
> 
> 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.
> >>
> >> Nicolas
> >>
> > 
> > Thanks for helping so accurately,
> > 
> > Sebastian
> > 
> > 
> > 
> 
> 




More information about the Squeak-dev mailing list