Contact

BITXOR Function (Gnumeric)

Math Intermediate Gnumeric Gnumeric 0.57

Toggle and compare binary flags with Gnumeric BITXOR, with native examples and clear newer-source differences for text, limits and empty inputs.

Verification status: 20 reference, boundary and advanced-check formulas were recalculated with Gnumeric 1.12.57 ssconvert. Retained native records and independent integer calculations were checked. Version 1.12.62 was source-checked only. How formula examples are checked

Version note: Native examples use Gnumeric 1.12.57. Current 1.12.62 source changes text conversion and the integer bound and also changes the empty-input result. See the version-specific section before reusing boundary results.

Quick answer: =BITXOR(9,5) gives 12 in the tested Gnumeric 1.12.57 build.

Availability and version history

  • Introduced: Gnumeric 0.57 release notes explicitly record the addition. Multiple-argument support was added in 1.12.51.
  • Supported in: Gnumeric 1.12.62; no retirement is established.
  • Scope: Desktop Gnumeric with its Number Theory plugin. English comma-separated formulas are shown.
  • Checked: October 14, 2026. Tables and the named advanced check were recalculated with 1.12.57 ssconvert. Current 1.12.62 source was inspected; the later release was not executed.

What BITXOR returns

BITXOR sets each result bit when that bit occurs an odd number of times across the collected inputs. With two inputs this means the bits differ. Binary 1001 XOR 0101 is 1100, so BITXOR(9,5) gives 12. Versioned function help.

Syntax and arguments

=BITXOR(value1[,value2,...])

Supply numeric values or ranges; multiple arguments are supported. Nonnegative fractions are floored by the helper. Native 1.12.57 ignores text and blanks and converts booleans to 1 or 0. Its empty numeric collection produces #VALUE!; the current source has a different empty case, explained below.

Brackets mark additional optional arguments; do not type the brackets. Current implementation.

Reproducible examples

For the range examples, enter numeric 1, 3 and 7 in F2:F4. Leave F5 empty. G2:G3 contain the text strings “3” and “5”, deliberately stored as text. H2:H4 contain TRUE, FALSE and numeric 2. These types were retained in the input and native outputs.

These eight native integer results were independently checked by binary arithmetic or elementary number theory.

Formula Gnumeric 1.12.57 result
=BITXOR(9,5) 12
=BITXOR(15,10) 5
=BITXOR(12,3) 15
=BITXOR(0,7) 7
=BITXOR(255,15) 240
=BITXOR(42,15) 37
=BITXOR(1,2,4) 7
=BITXOR(F2:F4) 5

Practical worksheet

A numeric mask can be toggled with XOR. Starting from 42, applying mask 15 switches each of its four low bits. Applying the same mask twice restores the original value: =BITXOR(BITXOR(42,15),15) returned 42.

Use this operation when toggling is genuinely intended. To turn a flag on regardless of its previous state, OR is the appropriate bitwise operation. XOR is also useful for locating differing bits between two numeric masks, but it does not count how many bits differ.

Advanced interpretation and checks

For more than two arguments, “present in exactly one input” is not the definition. A bit present in three inputs is still set because three is odd. The range F2:F4 contains 1, 3 and 7; their XOR is 5. The low bit appears three times, the middle bit twice, and the highest bit once.

XOR is associative and commutative, with x XOR x equal to zero. These are arithmetic identities for validated integer masks, not permission to silently ignore malformed text. The worksheet conversion rules determine which values reach the bitwise operation.

Version-specific source differences

Version-sensitive conversion: The tables record 1.12.57, which ignores text. Current 1.12.62 source instead requests numeric-string conversion: successfully parsed numbers participate, while failed numeric conversion gives #VALUE!. These newer conversion paths were source-checked, not executed. Older callback; current callback; string collector.

Empty-input difference: 1.12.57 returns #VALUE! when no numeric values remain; the 1.12.62 reducer has removed that guard and leaves the empty accumulator at zero. The native table must not be read as a current-version empty-input test.

For the standard binary64 build, the older shared input bound is 2^52 = 4503599627370496. The pinned 1.12.62 expression raises it to 2^53 = 9007199254740992. This change is established by comparing the older bound with the current bound; it is not a native test of 1.12.62. Input acceptance and exact representability of every resulting integer are separate questions.

Boundaries and troubleshooting

The tested 1.12.57 empty call and all-blank collection return #VALUE!. Current 1.12.62 source starts at zero without the older empty-count error guard, so its source-defined empty reduction is zero. That newer branch has not been executed here. Negative and above-bound values remain separately rejected.

F5 is an actually empty cell. Listed errors are native error results, not mathematical zeroes.

Formula Gnumeric 1.12.57 result
=BITXOR() #VALUE!
=BITXOR(F5) #VALUE!
=BITXOR(-1,1) #VALUE!
=BITXOR(9.9,5.9) 12
=BITXOR("9",5) 5
=BITXOR("abc",1) 1
=BITXOR(TRUE(),FALSE()) 1
=BITXOR(G2:G3) #VALUE!
=BITXOR(H2:H4) 3
=BITXOR(9007199254740992,1) #VALUE!
=BITXOR(9007199254740994,1) #VALUE!

Official evidence and checking scope

The retained workbook contained a deliberately stale SUM cache and an uncached SUM formula, both recalculated correctly. Native evidence covers the listed 1.12.57 cases. Other worksheet layouts and mathematical interpretations are separately explained checks. GUI entry, other locales and later-release output were not tested.