Order of operations in boolean algebra

Click For Summary

Discussion Overview

The discussion revolves around the order of operations in boolean algebra, specifically addressing the precedence of logical operators such as NOT, AND, OR, and XOR. The scope includes technical clarification and exploration of operator precedence in different contexts.

Discussion Character

  • Technical explanation, Conceptual clarification, Debate/contested

Main Points Raised

  • One participant questions the order of operations in boolean algebra, suggesting a possible sequence of NOT, AND, OR, and XOR.
  • Another participant asserts that the order of operations from high to low priority is NOT, AND, OR, with expressions in brackets evaluated first.
  • A subsequent post raises the question of XOR's precedence, noting its equivalence to "not equals" in C-based languages and discussing its precedence relative to AND and OR.
  • One participant suggests that the specific order may not matter significantly if parentheses are used to clarify expressions.

Areas of Agreement / Disagreement

Participants express differing views on the inclusion and precedence of XOR in the order of operations, indicating that there is no consensus on its placement relative to other logical operators.

Contextual Notes

Some statements rely on specific programming language conventions, which may not universally apply to boolean algebra in all contexts. The discussion does not resolve the precedence of XOR in relation to other operators.

Bipolarity
Messages
773
Reaction score
2
I have a rather technical question in boolean algebra to which I was not able to find an answer.

What is the order of operations in boolean algebra?
Is it first logical NOT, logical AND, logical OR, and finally logical XOR?

Correct me if I am wrong.

BiP
 
Physics news on Phys.org
The order of Boolean operations from high to low priority is NOT, AND, OR, while expressions inside brackets are always evaluated first.

http://www.doc.ic.ac.uk/~dfg/hardware/hardware.html, Handout, page 2.
 
What about XOR?

BiP
 
Since xor is equivalent as not equals, at least in C-based languages xor (as !=) has precedence over logical and (&&) and logical or (||). However, bitwise and (&) has precedence over bitwise xor (^), which in turn has precedence over bitwise or (|).

In the end, does it really matter? Just use parentheses and there's no doubt.
 

Similar threads

  • · Replies 7 ·
Replies
7
Views
3K
  • · Replies 21 ·
Replies
21
Views
3K
  • · Replies 10 ·
Replies
10
Views
1K
Replies
5
Views
3K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 34 ·
2
Replies
34
Views
4K
  • · Replies 12 ·
Replies
12
Views
8K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 40 ·
2
Replies
40
Views
9K