On Fri, Sep 7, 2012 at 7:41 AM, Denis Kudriashov <[email protected]> wrote:
> Thank's for your answer.
> Only one of your solutions works:
> (146.015 asMinimalDecimalFraction roundTo: 1/100) asFloat => 146.02
>
> Others not works:
>
> (146.015 * 100.0) rounded / 100.0 => 146.01
> (146.015 asFraction roundTo: 1/100) asFloat => 146.01
>
Another option it to load FixedDecimal, and use it for you fixed place work:
('146.015' asFixedDecimal: 3) roundTo: ('0.01' asFixedDecimal: 2) ==> 146.02
(Yes, Nicolas, I still haven't come up with a short way of specifying
FixedDecimals, but it will still load into Pharo without an issue.)
http://www.squeaksource.com/FixedDecimal.html
-Chris