# Order of computation [duplicate]

Possible Duplicate:
What is 48÷2(9+3)?

In the field of real numbers, does the expression 10 / 2 * 5 make sense? Is it 25 or 1? Is it a bad question or the order of computation from left-to-right is implicit (axiomatic) when omitting parentheses?

-

## marked as duplicate by Pedro Tamaroff♦, Gerry Myerson, Leonid Kovalev, tomasz, Jennifer Dylan Aug 17 '12 at 19:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

See here for discussion of the order of operations. – Zev Chonoles Mar 21 '12 at 21:26
en.wikipedia.org/wiki/Order_of_operations – user2468 Mar 22 '12 at 1:54
With the resources you have today, always do web search first then post here. – Kirthi Raman Mar 22 '12 at 20:48

## 2 Answers

The computer languages I have used explicitly say that 10/2*5=25. For writing, I would always include the parentheses to be clear.

-

The most widespread convention is that operations of equal precedence are performed from left to right in the absence of parentheses; by this convention $10/2\cdot 5=25$. However, it is violated often enough, intentionally or otherwise, that in such cases one should always supply enough parentheses or other cues to make the intended sense clear: $(10/2)\cdot 5$, $(10/2)(5)$, $\frac{10}2\cdot5$, $\frac12(10)(5)$, etc. However, this left-to-right convention is normally superseded by precedence conventions, so that $2+3\cdot5=17$, not $30$.

Most of the programming languages that I’ve seen follow these conventions, though they may differ slightly in the precedence of some operations; two exceptions that I know about are Smalltalk, which uses a strict left-to-right convention with no built-in precedence hierarchy, and APL, which, like the Iverson notation on which it was based, uses a strict right-to-left convention.

-