Documentation/Calc Functions/BITXOR

From The Document Foundation Wiki
Jump to: navigation, search

Other languages:
dansk • ‎English

Function name:

BITXOR

Category:

Mathematical

Summary:

Returns a bitwise logical "exclusive or" of the parameters. Each bit position is returned as 1 if the values of the parameters at that bit position are not equal; in other words, one value is 0 and the other is 1.

Syntax:

BITXOR(Number 1; Number 2)

Returns:

Returns a positive integer.

Arguments:

Number 1 and Number 2 are positive integers less than 2 ^ 48 (281,474,976,710,656).

  • If either argument is a decimal number then its floor value is considered.
  • If either argument is less than 0, BITOR returns the Err:502.
  • If either argument is greater than (2^48)-1, BITXOR returns the error value.

Additional details:

None

Examples:

Formula Description Returns
=BITXOR(6;10) 6 in binary is 0110 and 10 in binary is 1010 so
(0110 ^ 1010 = 1100)
12 (1100)
=BITXOR(6.123;10) floor value of 6.123 is taken so 6 in binary is 0110 and 10 in binary is 1010 so
(0110 ^ 1010 = 1100)
12 (1100)
=BITOR(123;156) 123 in binary is 01111011 and 156 in binary is 10011100 so
(0110 ^ 1010 = 11100111)
231 (11100111)
=BITXOR(123; 2^48 + 5) number 2 argument is greater than 2^48 hence it will return an error Err:502
=BITXOR(123; -5) number 2 argument is negative hence it will return an error Err:502
BITXOR example showing that if both number have different bit on a position then the function returns 1 at that position.

Related LibreOffice functions:

XOR

BITOR

BITAND

ODF standard:

Section 6.6.6, part 2

Equivalent Excel functions:

BITXOR