Operator precedence for: 1/-2/3

  • Context: Undergrad 
  • Thread starter Thread starter Twinbee
  • Start date Start date
  • Tags Tags
    Operator
Click For Summary

Discussion Overview

The discussion revolves around the interpretation of the expression 1/-2/3, specifically regarding operator precedence in mathematical expressions. Participants explore how different interpretations can lead to varying results, with implications for programming languages and calculators.

Discussion Character

  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants propose that the expression 1/-2/3 can yield two potential answers: A: -0.1666666667 and B: -1.5, depending on how operator precedence is interpreted.
  • One participant argues that division should be performed before the unary minus, suggesting that using brackets like 1/(-(2/3)) clarifies the intended operation.
  • Another participant challenges the idea that division is performed before unary minus, questioning the meaning of 1/-2 in that context.
  • Some participants note that the precedence of operators like exponentiation (^) is higher than unary minus, implying that similar precedence rules should apply to division and multiplication.
  • There is a suggestion that the order of operations should be made clear through the use of parentheses to avoid ambiguity.
  • One participant mentions that while programming languages may differ, many follow conventions similar to those established in C, which could influence how expressions like this are evaluated.

Areas of Agreement / Disagreement

Participants express differing views on the precedence of division relative to unary minus, with no consensus reached on the correct interpretation of the expression 1/-2/3.

Contextual Notes

The discussion highlights the ambiguity in operator precedence and the potential for different interpretations based on context, such as mathematical conventions versus programming language rules.

Twinbee
Messages
116
Reaction score
0
The sum below has two potential answers:

A: 1/-2/3 = -0.1666666667
B: 1/-2/3 = -1.5

Programming languages and most (but not all) calculators claim A is correct.

However, B seems to follow operator precedence more accurately as the division is performed before the unary minus. Using brackets:

1/(-(2/3))
...makes more sense than:
(1/-2)/3

Is there a more official stance on the issue?
 
Mathematics news on Phys.org
Twinbee said:
division is performed before the unary minus.
That sounds backwards to me.
 
If "division is performed before unary minus", what does 1/-2 mean?
 
That sounds backwards to me.
Okay, most people would agree that:

-3^2 = -9

So there the exponential operator has precedence over the unary minus. If ^ has precedence, it makes sense to reason that / and * should have precedence too.

If "division is performed before unary minus", what does 1/-2 mean?

The ordering of the symbols fundamentally disallows the / to be performed first here.
 
Last edited:
The order of the unitary minus has nothing to do with it. The unitary minus is equivalent to multiplying by -1. The question is which division is performed first and the convention is to use some D*** parentheses!
When there is no good reason to assume someone can figure out what you mean, don't assume someone can figure out what you mean, just say it. However, if you have a gun to you head and are asked which one is right, I'd say "A" since it reads left to right and there is no convention in math (maybe there is in compsci where the computer doesn't have an option to think about it).
 
Twinbee said:
Okay, most people would agree that:

-3^2 = -9

So there the exponential operator has precedence over the unary minus. If ^ has precedence, it makes sense to reason that / and * should have precedence too.
But the ^ operator is different from the arithmetic operators +, -, *, and /, and has higher precedence. For that reason, 3^2 + 2 is evaluated as 9 + 2 = 11, rather than 3^(2+2) = 81. Similarly 2 * 3^2 = 2 * 9 = 18, not 6^2 = 36.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 14 ·
Replies
14
Views
3K
  • · Replies 23 ·
Replies
23
Views
3K
  • · Replies 25 ·
Replies
25
Views
3K
  • · Replies 7 ·
Replies
7
Views
26K