Tabular IQ
Back to Function Index

LOG()

Overview

LOG() returns the logarithm of a number in the specified base. If no base is specified, LOG() uses a default base of ten. If the input is invalid (e.g., negative numbers, zero, or invalid base), the function returns zero. This function is useful for mathematical calculations, scientific computations, and data analysis.

Function Format

LOG(number [, base])

Return Value

LOG() returns a numeric value

Examples


LOG(10) = 1                  (log base 10 of 10)
LOG(10, 2) = 3.3219         (log base 2 of 10)
LOG(1024, 2) = 10           (log base 2 of 1024)
LOG(1, 0) = 0               (invalid base)
LOG(100) = 2                (log base 10 of 100)
LOG(8, 2) = 3               (log base 2 of 8)
LOG(0) = 0                  (invalid input)
LOG(-1) = 0                 (invalid input)
LOG(NULL) = NULL            (NULL input)

Notes

  • Important behaviors:
    • Returns 0 for invalid inputs (negative numbers, zero, or invalid base)
    • Returns NULL for NULL input
    • Default base is 10 if not specified
    • Base must be positive and not equal to 1
    • Number must be positive
  • Common use cases include:
    • Mathematical calculations
    • Scientific computations
    • Data analysis
    • Scale transformations
    • Growth rate calculations
  • The function can be used with:
    • Numeric literals
    • Numeric columns
    • Numeric expressions
    • Other numeric functions
  • This function is often used in combination with other mathematical functions like LN(), EXP(), and POWER() for more complex calculations.
  • For natural logarithm (base e), use the LN() function instead.

See Also