You are viewing a single comment's thread from:

RE: 6÷2(1+2)= ? is it 1 or 9?

in #mathematics8 years ago

I also came up with 9.... but the compiler statement made me wonder if I could find a language that answers with 1:

Python: 9
Go: 9
c++14=9
C++11=9
C++98 = 9
php=9
Cobol=9 (that was a pain!!)
erlang=9
TCL=9
Scala=9
Rust=9
Pike=9
NIM=9
Julia=9
Fortran=9

Nope couldn't find one!

Sort:  

Guess I'm showing my age. I'm pretty sure I might've found a compiler 30 years ago that would've answered 1. It's not something I've paid attention to recently, though.

This article addresses it - http://mathforum.org/library/drmath/view/52582.html - "Some of the specific rules were not yet established in Cajori's own time (the 1920s). He points out that there was disagreement as to whether multiplication should have precedence over division, or whether they should be treated equally."

and "There is still some development in this area, as we frequently hear from students and teachers confused by texts that either teach or imply that implicit multiplication (2x) takes precedence over explicit multiplication and division (2*x, 2/x) in expressions such as a/2b, which they would take as a/(2b), contrary to the generally accepted rules. The idea of adding new rules like this implies that the conventions are not yet completely stable; the situation is not all that different from the 1600s.

In summary, I would say that the rules actually fall into two categories: the natural rules (such as precedence of exponential over multiplicative over additive operations, and the meaning of parentheses), and the artificial rules (left-to-right evaluation, equal precedence for multiplication and division, and so on). The former were present from the beginning of the notation, and probably existed already, though in a somewhat different form, in the geometric and verbal modes of expression that preceded algebraic symbolism. The latter, not having any absolute reason for their acceptance, have had to be gradually agreed upon through usage, and continue to evolve."