Documentation/Calc Functions/LOG

    From The Document Foundation Wiki
    Other languages:


    Function name:

    LOG

    Category:

    Mathematical

    Summary:

    Calculates the logarithm to a specified base of a positive real number.

    Syntax:

    LOG(Number [; Base])

    Returns:

    Returns a real number that is the logarithm to the specified base of the given number.

    Arguments:

    Number is a positive real number, or a reference to a cell containing that number, that is the value for which the logarithm is to be calculated.

    Base is a positive real number, or a reference to a cell containing that number, that is the base to be used for calculating the logarithm of Number. If Base is omitted, LOG uses a default value of 10.

    • If either Number or Base is non-numeric, then LOG reports a #VALUE! error.
    • If either Number or Base is less than or equal to 0, then LOG reports an invalid argument error (Err:502).
    • If Base is equal to 1, then LOG reports an invalid argument error (Err:502).

    Additional details:

    • The following change of base formula may be used to determine a logarithm for any base:

    [math]\displaystyle{ \text{log}_b(x)~=~\frac{\text{log}_d(x)}{\text{log}_d(b)} }[/math]

    This formula is valid for positive real numbers x, b, and d, such that neither b nor d is equal to 1.
    • The figure below illustrates the LOG function when Base is set to 2 (known as binary logarithms).
      LOG base-2
    • See LN for the corresponding illustration when Base is set to the mathematical constant e (natural logarithms).
    • See LOG10 for the corresponding illustration when Base is set to 10 (common logarithms).

    Examples:

    Formula Description Returns
    =LOG(3.5; 5) Here the function returns the logarithm to base 5 of 3.5. 0.778385397048775
    =LOG(0.5; 4) Here the function returns the logarithm to base 4 of 0.5. −0.5
    =LOG(D1; D2) where cells D1 and D2 contain the numbers 1 and 9 respectively. Here the function returns the logarithm to base 9 of 1 (the logarithm of 1 is always zero, for any base). 0
    =LOG(2.5; 5.7) Here the function returns the logarithm to base 5.7 of 2.5. 0.526462820777384
    =LOG(POWER(7; 34); 7) Here the function returns the logarithm to base 7 of 7 raised to the power of 34, which is 34. 34
    =POWER(13; LOG(789, 13)) Here the function returns 13 to the power of the logarithm to base 13 of 789, which is 789. 788.999999999999

    Related LibreOffice functions:

    EXP

    LN

    LOG10

    POWER

    ODF standard:

    Section 6.16.40, part 2

    Related (or similar) Excel functions:

    LOG