Skip to content

^ means XOR in C, Java and Python, not AND or power

^ is exclusive or in C, Java, JavaScript and Python, a power in Excel and many calculators, and conjunction in some logic texts. The parser rejects A ^ B and offers XOR, because three readings are two too many.

The diagnostic recorded below says it plainly: ^ is not supported, it is bitwise in many languages, use XOR or ⊕. In C-family languages the operator is bitwise exclusive or on integers, which coincides with logical XOR only when both operands are 0 or 1; 2 ^ 4 is 6. In Python it is also XOR on bool values. In spreadsheets and calculators 2^3 is eight. In older logic notation ∧ was sometimes typed as ^ for lack of the symbol, making it AND.

The engine's own spelling of exclusive or is the word XOR or the symbol ⊕, and its programming notation prints XOR as a word rather than choosing one language's symbol. The XOR operator page gives the two-, three- and four-input tables, and the parity pitfall explains why a chain of XOR is not “exactly one”.

If you are translating code, the table on the language page for C, Java or JavaScript shows how to get a logical XOR safely (!a != !b in C, a !== b on JavaScript Booleans) and when ^ is fine (two boolean values in Java).

What the parser says

You typedCodeWhy it is rejectedRepair offered
A ^ Bunsupported-operator`^` is not supported (it is bitwise in many languages). Use `XOR` or `⊕`.Replace with XOR

The common slip

Copying a ^ b from C into a rule as if it were AND, because the caret looks like the wedge ∧. The parser stops the copy; a tool that accepted ^ silently would have produced the wrong function without a word.

Questions

Is ⊕ the same as ^?

⊕ is the mathematical symbol for exclusive or and is accepted. ^ is rejected because its meaning depends on the source; the repair replaces it with XOR.

What is XOR in terms of the other operators?

(A AND NOT B) OR (NOT A AND B), by the XOR elimination law, which the engine proves on its page.

Related

Tools

See also

Pitfalls

Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.