I use the Printf package for that.

v := 65.456.
'With 2 decimal digits: %5.2f, or 3 like this: %6.3f'
printf: {v. v}.

With 2 decimal digits: 65.45, or 3 like this: 65.456

It is in http://www.smalltalkhub.com/#!/~philippeback/HOExtras

Printf

I am just used to C printf and well, I like the way it works.

Phil

On Sun, Oct 23, 2016 at 6:35 PM, stepharo <[email protected]> wrote:

> I see.
>
> I writing a little example for my new newbies book
>
> now how can get only two digits after the .
>
>
> Stef
>
> Le 23/10/16 à 18:23, Thierry Goubier a écrit :
>
> I think that's called 'welcome to the wonderfull world of floating points
> approximations' and not a bug :(
>
> See unums/Gustafson for something more interesting on the subject.
>
> Thierry
>
> 2016-10-23 18:16 GMT+02:00 stepharo <[email protected]>:
>
>> Hi
>>
>> I'm wondering if we do not have a bug here
>>
>> 12.222222222222221 roundTo: 0.1
>>  "12.200000000000001"
>>
>> 12.222222222222221 roundTo: 0.01
>>  "12.22"
>>
>>
>> Stef
>>
>>
>>
>
>

Reply via email to