Exclusive or
Exclusive or, exclusive disjunction, exclusive alternation, logical non-equivalence, or logical inequality is a logical operator whose negation is the logical biconditional. With two inputs, XOR is true if and only if the inputs differ (one is true, one is false). With multiple inputs, XOR is true if and only if the number of true inputs is odd.[1]
"XOR" redirects here. For the logic gate, see XOR gate. For other uses, see XOR (disambiguation).
It gains the name "exclusive or" because the meaning of "or" is ambiguous when both operands are true. XOR excludes that case. Some informal ways of describing XOR are "one or the other but not both", "either one or the other", and "A or B, but not A and B".
It is symbolized by the prefix operator [2]: 16 and by the infix operators XOR (/ˌɛks ˈɔːr/, /ˌɛks ˈɔː/, /ˈksɔːr/ or /ˈksɔː/), EOR, EXOR, , , , ⩛, , , and .
Negation of the operator[edit]
The spirit of De Morgan's laws can be applied, we have:
The symbol used for exclusive disjunction varies from one field of application to the next, and even depends on the properties being emphasized in a given context of discussion. In addition to the abbreviation "XOR", any of the following symbols may also be seen:
Encodings[edit]
It is also called "not left-right arrow" (\nleftrightarrow
) in LaTeX-based markdown (). Apart from the ASCII codes, the operator is encoded at U+22BB ⊻ XOR (⊻) and U+2295 ⊕ CIRCLED PLUS (⊕, ⊕), both in block mathematical operators.