log function

The log function returns the logarithmic value with the specified base for the given expression.

Syntax:

double log(n,b)

Semantics:

  • n, b: The arguments n and b are expressions that resolve to numbers. The base b can resolve to any positive value except zero and one. n can resolve to any positive value.
  • return type: double.
    • Returns a NULL value in the following cases:
      • If either of the arguments resolves to a NULL value
      • If either of the arguments does not resolve to a number
    • Returns positive infinity if either of the arguments resolves to positive infinity.
Example:
SELECT log(n,b) FROM PHtable
Value of n Value of b Output
2 2 1.0
81 3 4.0
255 5 3.442980622208573