You are viewing a single comment's thread from:

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

in #mathematics8 years ago

Depends on the compiler. ; -) I'm pretty sure that I learned multiply, then divide, then add, then subtract in grade school, but by the time college rolled around, the convention had switched to multiply & divide in order from left to right, then add & subtract in order from left to right. So I wouldn't say either answer is right or wrong. People probably just learned different orders of operations. Technically, 9 i s probably the more modern convention. I'll bet the answer people give probably tells you something about their age.

IMO, the best answer is to rewrite the expression in a less-ambiguous way.

Sort:  

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!

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."

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.028
BTC 63177.41
ETH 2439.37
USDT 1.00
SBD 2.58