PDA

View Full Version : [QOD] Operators precedences



ErosOlmi
06-02-2013, 23:48
Which of the poll expressions will provide a different answer ?

3 out 4 of the above expressions will return the same result.
1 out of 4 will return a different result

Reply quickly without looking at other's posts :)

Petr Schreiber
07-02-2013, 10:15
I think the different one should be #2, because of the ( 9 - ( 5 + 8 ) ) member... such a brain damaging task in the morning... :D

The first part of the expression (45*) is the same, the middle one (with 9,5,8) differs in the second formula and the last one (36,4) is the same, because "/" has bigger priority than "-", so brackets make no difference.


Petr

ErosOlmi
07-02-2013, 12:10
:)

Of course this forum is just an "excuse" (I hope an enjoyable "excuse") to activate some interest in different matters all of you are interested in.
Not great complication, just little "How to ...", "do you know ...", "are you able to ...", ...

ReneMiner
08-02-2013, 00:22
I knew the solution and voted right - before your spoilers appeared. Now I just ask myself - who of you both, Petr or John voted the wrong result?
When I voted, mine was the second vote, the first was of Eros since that time no other users who read this thread were displayed.
There are four votes right now: 3 (75%) for the right solution, 1 (25%) was wrong.
Now each of you (presumed you are the voters) knows, who did the wrong guess since I know that mine and Eros are right.
If one of you did not vote yet - you should do it now and clear yourself from my suspicions :D

ErosOlmi
08-02-2013, 00:41
...... :comp1:

:D

LCSims
09-02-2013, 04:40
It took a few seconds and I needed to delve into the memory banks for computational priority (don't know if that's a real term, but it sounds intelligent), then the inner parenthesis gave me the clue to go with #2.

Now I'll go take a nap, as too much thinking is not a good thing at my age. As witnessed by me taking months trying to work out a looping routine, but I'll get there some day. :D

Lance