5.3 printShowingDecimalPlaces: 2 displays '5.29' instead
tim at rowledge.org
Thu Nov 22 19:09:56 UTC 2007
On 22-Nov-07, at 11:00 AM, Sebastian Sastre wrote:
> Thanks Tim,
> may be I should clarify that it's only for presentation. The
> mone value is stored as anMeasure of it's monetary unit in the
> Aconcagua framework.
> But I'm curious about your answer. Let's supose the user enters
> in some input widget with keyboard the '5.30' value. That will end
> as a Float at some point. Do you suggest I convert that to a
> ScaledDecimal? (to store/comare, etc)?
> I'm evaluating this:
> (5.3 asScaledDecimal: 2)
> and also obtainig: ' 5.29s2'
That must surely count as a bug and I'd hazard a guess that it happens
because some code is comparing floats; I've not looked at the code but
I've seen it too many times not to suspect it.
As for your input widget, I'd try to make it give you the string and
directly convert that to a 2dp scaled decimal rather than letting it
give you a float. If there isn't a String>asScaledFloat: type method
then I guess you get to write it :-)
tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
All the simple programs have been written, and all the good names taken.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Squeak-dev