LOG
Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Returns the base 10 logarithm of a number or the logarithm to a specified base.
Syntax
Arguments
Required
<x>: The value to evaluate.
Optional
<b>: The logarithm base. When provided, the function returns the logarithm of x to base b. When omitted, the function returns the base 10 logarithm.
Returns
Returns the logarithm as a double precision value.
Considerations
log returns an error for zero or negative arguments.
- A base of
1 is undefined and returns an error.
Examples
Compute a Base 10 Logarithm
Get the base 10 logarithm of a value.
1SELECT log(100.0) AS result;
Returns 2.0.
Compute a Logarithm to a Specified Base
Get the logarithm of a value to base 2.
1SELECT log(2.0, 64.0) AS result;
Returns 6.0000000000.
Related Documentation