# Precedence of concatenation: Is $5/7y$ equal to $(5/7)\times y$ or $5/(7\times y)$? [duplicate]

What is the precedence of the concatention operator when used for multiplication?

If it's the same as multiplication, 5/7y would mean (5/7)*y.

However, it also seems reasonable to see it as 5/(7*y).

I realize I can avoid the issue by writing "5y/7" or using explicit parentheses, but am curious about the "correct" answer.

Googling was surprisingly unhelpful: most results were about the precedence of string concatention in programming languages.

-

## marked as duplicate by Ross Millikan, J. M., Jennifer Dylan, sdcvvc, t.b.Aug 26 '12 at 18:51

Duplicates: here, here, and here – process91 Aug 26 '12 at 15:48
You are right that it is confusing and should therefore be avoided. I suspect that most people who write it are thinking $5/(7y)$. – Ross Millikan Aug 26 '12 at 15:48
"When there's doubt on how it's seen in others' eyes\always remember to parenthesize!" – J. M. Aug 26 '12 at 15:50
PARI interprets 5/7*x as (5/7)x, just as a point of reference. I personally think the notation without parentheses is ambiguous and should be avoided. – KCd Aug 26 '12 at 15:51
@Thomas: If you don't know how to get a symbol in LaTeX, Detexify is of great help. Assuming you meant the symbol $\div$, I've just used it to find that it is generated by the macro \div. – celtschk Aug 26 '12 at 16:00

I realize I can avoid the issue by writing "5y/7" or using explicit parentheses.

I don't know of any "correct" way to interpret $5/7y$, and I don't believe that there is any. There are lots of notations in math that are not that clear, and the only answer is to make them clear. So I would never write $5/7y$ on a blackboard if I meant $5/(7y)$.

If you by $5/7y$ mean $5/7*y$, then from what I understand, when programming a compiler would interpret this as $5*y/7$.

-
Actually in the vast majority of programming languages, 5/7y would simply be a syntax error, because multiplication needs generally be explicitly written with *. In C++11 it could, however, denote the division of the standard integer 5 by a user-defined numeric literal 7y (which most likely will be the number 7 represented by an user-defined numeric type). Indeed, the only programming language I know where juxtaposition is interpreted as multiplication is Mathematica's; here indeed 5/7y means $(5/7)y$. – celtschk Aug 26 '12 at 15:56
@celtschk: You are right! I will edit – Thomas Aug 26 '12 at 15:58
Speaking of Mathematica, IIRC Singular also interprets juxtaposition as multiplication. – user2468 Aug 26 '12 at 16:09

I believe concatenation strictly applies to the joining of two strings together. I would imagine that extending this to mathematical operations there would be parenthesis around the objects in order to avoid ambiguity, ie $$5/7 * y/x$$ would yield $$\dfrac{5}{7}\cdot\dfrac{y}{x}$$

-