5.3 printShowingDecimalPlaces: 2 displays '5.29' instead of'5.30'

Sebastian Sastre ssastre at seaswork.com
Thu Nov 22 19:00:05 UTC 2007

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'
    so I'm still lost about it,
Sebastian Sastre


De: squeak-dev-bounces at lists.squeakfoundation.org
[mailto:squeak-dev-bounces at lists.squeakfoundation.org] En nombre de tim
Enviado el: Jueves, 22 de Noviembre de 2007 16:18
Para: The general-purpose Squeak developers list
Asunto: Re: 5.3 printShowingDecimalPlaces: 2 displays '5.29' instead

On 22-Nov-07, at 10:03 AM, Sebastian Sastre wrote:

Hi there,
    I'm geting this unexpected result from a Squeak 3.9 final 7067 image.
    I need to display money values with two digits. Has anybody a sugestion
to correctly achieve this?

First and most important - don't maintain money as floating point numbers.
Second - never do simple compares of floating point numbers.

tim Rowledge; tim at rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: FSRA: Forms Skip and Run-Away

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20071122/1a37fe5f/attachment.htm

More information about the Squeak-dev mailing list