Documentation/Calc Functions/BITOR

    From The Document Foundation Wiki


    Function name:

    BITOR

    Category:

    Mathematical

    Summary:

    Performs a bitwise OR binary operation on two non-negative integer values.

    Syntax:

    BITOR(Number1; Number2)

    Returns:

    Returns an integer in the range [0, 248-1], which is the result of the bitwise OR 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 OR 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 OR operation.

    • If either Number1 or Number2 is non-numeric, then BITOR reports a #VALUE! error.
    • If either Number1 or Number2 is a non-integer value, then BITOR truncates that value to an integer.
    • If either Number1 or Number2 is less than 0 or greater than 248-1, then BITOR 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
    =BITOR(6; 10) 6 is binary 0110 and 10 is binary 1010. The function evaluates 0110 OR 1010 and returns decimal 14 (binary 1110). 14
    =BITOR(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 OR 10011100 and returns decimal 255 (binary 11111111). 255
    =BITOR(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 OR 1010 and returns decimal 14 (binary 1110). 14

    Related LibreOffice functions:

    BITAND

    BITLSHIFT

    BITRSHIFT

    BITXOR

    OR

    ODF standard:

    Section 6.6.4, part 2

    Related (or similar) Excel functions:

    BITOR since v.2013.