Documentation/Calc Functions/BITXOR

    From The Document Foundation Wiki


    Function name:

    BITXOR

    Category:

    Mathematical

    Summary:

    Performs a bitwise XOR (exclusive OR) binary operation on two non-negative integer values.

    Syntax:

    BITXOR(Number1; Number2)

    Returns:

    Returns an integer in the range [0, 248-1], which is the result of the bitwise XOR operation on the two supplied numbers.

    Arguments:

    Number1 is an integer in the range [0, 248-1], or a reference to a cell containing that number, that is the first value for the bitwise XOR operation.

    Number2 is an integer in the range [0, 248-1], or a reference to a cell containing that number, that is the second value for the bitwise XOR operation.

    • If either Number1 or Number2 is non-numeric, then BITXOR reports a #VALUE! error.
    • If either Number1 or Number2 is a non-integer value, then BITXOR truncates that value to an integer.
    • If either Number1 or Number2 is less than 0 or greater than 248-1, then BITXOR reports an invalid argument error (Err:502).

    Additional details:

    • More information is available on Wikipedia’s Bitwise operation page.
    • 248 is equal to 281474976710656.

    Examples:

    Formula Description Returns
    =BITXOR(6; 10) 6 is binary 0110 and 10 is binary 1010. The function evaluates 0110 XOR 1010 and returns decimal 12 (binary 1100). 12
    =BITXOR(D1; D2) where cells D1 and D2 contain the numbers 123 and 156 respectively. 123 is binary 01111011 and 156 is binary 10011100. The function evaluates 01111011 XOR 10011100 and returns decimal 231 (binary 11100111). 231
    =BITXOR(6.123; 10.9) The floor values of the two arguments are taken, giving 6 (binary 0110) and 10 (binary 1010). The function evaluates 0110 XOR 1010 and returns decimal 12 (binary 1100). 12

    Related LibreOffice functions:

    BITAND

    BITLSHIFT

    BITOR

    BITRSHIFT

    XOR

    ODF standard:

    Section 6.6.6, part 2

    Related (or similar) Excel functions:

    BITXOR since v.2013.