Document: WG14 N1738

## Background on -yx and -y/v

Submitter: Fred J. Tydeman (USA)
Submission Date: 2013-08-20
Subject:Background on -yx and -y/v

In the many math books I have read over the years, I have never seen anything about operator precedence. So, when converting from the math -yv to C, it could be one of:

• (-y)*v
• -(y*v)
• (-1)*(y*v)
• ((-1)*y)*v
• 0-(y*v)

What does -x mean? The two obvious choices are:

• 0-x
• (-1)*x

However, -1 depends upon the meaning of -x (so is recursive loop).

I did a web search for "order of operations math" and got many hits.

1. exponents and roots
2. multiplication and division

There exist differing conventions concerning the unary operator "-" (usually read "minus"). In written or printed mathematics, the expression -32 is interpreted to mean -(32) = -9, but in some applications, -32 is interpreted to mean (-3)2 = 9.

Similarly, there can be ambiguity in the use of the slash ('/') symbol in expressions such as 1/2x. It can mean (1/2)x or 1/(2x).

The above wikipedia URL has a reference to http://planetmath.org/orderofoperations which has a different order of operations:

1. Factorial.
2. Exponentiation.
3. Multiplication.
4. Division.

Another web hit is: http://www.purplemath.com/modules/orderops.htm has:

PEMDAS:

1. Parentheses
2. Exponents
3. Mutiplication and Division

BODMAS:

1. Brackets
2. Orders
3. Division and Mutiplication