Hi Richard,
+1 to what was asked by Stef.
How hard is it to bring your knowledge, and existing implementation,
into a "proper" implementation of ScaledDecimal (or FixedPoint) in
Pharo?
Regards!
Esteban A. Maringolo
On Wed, Sep 2, 2020 at 12:12 PM Stéphane Ducasse
wrote:
>
> Richard
>
> we are
Richard
we are really interested in improving Pharo on that aspect.
Now I’m really not good with such domain.
Can you send us some code and tests?
S.
> On 2 Sep 2020, at 12:31, Richard O'Keefe wrote:
>
> The behaviour of ScaledDecimal in Squeak and Pharo is
> - different from what the ANSI
The behaviour of ScaledDecimal in Squeak and Pharo is
- different from what the ANSI Smalltalk standard says
- different from what other Smalltalks do (not that they agree)
- completely different from decimal arithmetic in COBOL, PL/I, or SQL
- seriously confusing.
What you EXPECT is an exact
Hi john you can propose for inclusion in pharo.
- Add a nice comment (with executablecomments would be a plus).
- Possibly some tests
- Send a PR.
> On 1 Sep 2020, at 09:32, John Aspinall wrote:
>
> Dolphin shows the same behaviour. I added the following method to
> ScaledDecimal to help:
>
Hi John,
I was doing a similar rounding in the test assertion, I think your
method is better and broadly usable (and maybe convenient for an
#equals: implementation).
Thanks!
Esteban A. Maringolo
On Tue, Sep 1, 2020 at 4:33 AM John Aspinall wrote:
>
> Dolphin shows the same behaviour. I added
It evaluates to false in VW too.
I guess it is a matter of internal representation, since
ScaledDecimals/FixedPoints are a Fraction after all.
What is weird, and I'd say wrong (at least from the UX perspective) is
that in Pharo (and Dolphin):
((91 - (2 * 35.9) - (0 / 2) * (113/121)) roundTo:
Interesting. Your expression evaluates to true in VA Smalltalk.
Am 01.09.20 um 06:17 schrieb Esteban Maringolo:
As a follow up to this, adding a roundTo: before converting into a
ScaledDecimal does not work.
(((91 - (2 * 35.9) - (0 / 2) * (113/121)) roundTo: 0.1)
asScaledDecimal: 1) = 17.9s1
As a follow up to this, adding a roundTo: before converting into a
ScaledDecimal does not work.
(((91 - (2 * 35.9) - (0 / 2) * (113/121)) roundTo: 0.1)
asScaledDecimal: 1) = 17.9s1
So how do you compare two ScaledDecimals that _should_ be the same?
Regards!
Esteban A. Maringolo
On Tue, Sep
Hi,
I was doing some basic calculations based on a formula, and I wanted
to convert the result to a scaled decimal in order to avoid having
these "loose" decimals in 10th position or something similar.
So I did the following:
82 - (2 * 35.9) - (0 / 2) * (113/121) asScaledDecimal: 1 -> 9.5s1
But