Ah, OK, sorry about the misunderstanding.
On 20 Dec 2016, at 09:21, Stephane Ducasse <stepharo.self@gmail.com> wrote:
I think that I know that :) And this is why I mentioned that if you print 1/3 it prints (1/3) so that we can continue typing + (2/3)
On Mon, Dec 19, 2016 at 11:02 PM, Sven Van Caekenberghe <sven@stfx.eu> wrote:
On 19 Dec 2016, at 22:00, Stephane Ducasse <stepharo.self@gmail.com> wrote:
Hi serge
the printing should be normal because like that you are ready to type 1/3 + 2/3 and get 1.
No, not at all:
1/3 + 2/3
"(7/9)"
These are all just binary messages evaluated left to right, like this:
((1/3) + 2)/3
"(7/9)"
That is why you need the parenthesis in certain contexts. Now adding two of them is definitively wrong.
(1/3) + (2/3)
"1"
(The first parenthesis are not needed, btw).
Now I do not get why you get ((1/2)) thanks for reporting it.
Stef
On Mon, Dec 19, 2016 at 9:08 AM, Serge Stinckwich <serge.stinckwich@gmail.com> wrote: I have one question about Fraction.
When I print a fraction like 1/2 in the Playground I obtain (1/2) and when I inspect I obtain ((1/2)). Why do we need all these parentheses ?
I didn't try with a current Pharo 6.0 image, because my bandwidth is quite limited right now (Vietnam).
-- Serge Stinckwich UCBN & UMI UMMISCO 209 (IRD/UPMC) Every DSL ends up being Smalltalk http://www.doesnotunderstand.org/