But ... the iPhone gives 2? I don't get it.
(FWIW, Android says 9)
But ... the iPhone gives 2? I don't get it.
(FWIW, Android says 9)
5(2) = 2
999(2+2) = 4
2*2455(6) = 12
2+47435)7 = 14
(according to the iPhone calculator in scientific mode)I get 9 as written on my iPhone. The correction above gives 14.
The interesting thing to me is that the close parenthesis cause the same behavior. The consistent logic appears to be "an operator entered in error causes input to reset" or something like that. Also errors are silently ignored in the easiest way possible, perhaps internally the value never gets pushed to the stack or something along those lines.
I wonder what other 'errors' could show this behavior?
6 ÷ 2 ( 1 + 2 )
6 ÷ ( 1 + 2 )
6 ÷ ( 3 )
2
The iPhone appears to operate this way:
6
6%
6%2
6%(
At this point the 2 (or any value in that slot) has been dropped
6%(1
6%(1+
6%(1+2
6%(1+2)
and the result is processed in this order:
6%(3)
6%3
2
giving the result.It appears what most people are objecting to is that it performs an unexpected operation when it discards the value at 2 (because opening the parenthesis without giving 2 an operator has been designed to be 'invalid') but it does NOT indicate this in ANY way.
It is also interesting to note that all of his other examples had the entire formula written out, where the iPhone did not. If it had, it would have been more clear when the 2 was dropped.