> On 6 Sep 2020, at 16:06, Esteban Maringolo <emaring...@gmail.com> wrote:
> 
> Hi,
> 
> Continuing with my issues with decimals, I'm having one issue that is
> not clear to me why it happens.
> 
> If I do:
> (9.1 + (-2.0)) roundTo: 0.1.
> "7.1000000000000005"
> 
> I expect to get a single decimal Float (rounded with whatever
> precision, but a single decimal).
> 
> Even if I do something like this:
> 7.1 roundTo: 0.1
> 
> It gives the wrong result.
> 
> In VW and VAST it provides the right result.
> (9.1 + (-2.0)) roundTo: 0.1 "7.1"
> 
> In Dolphin it also returns the wrong result, it seems to use the same
> algorithm to round it.
> 
> Is this a bug?

Maybe.

But I would not approach the problem of rounding like that. 
You probably want to control how numbers are printed.
I would keep the numbers themselves at maximum internal precision and only do 
something when printing them.

1 / 3 asFloat printShowingDecimalPlaces: 1.

Since you like Seaside, the following is even much more powerful (has *many* 
options):

GRNumberPrinter new precision: 1; print: 1/3 asFloat.

Check it out.

> 
> Esteban A. Maringolo
> 


Reply via email to