Order of operations in boolean algebra

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 36K views
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.