LOG()

All functions > MATH > LOG()

Returns the logarithm of a number to a specified base.

Signatures

Logarithm

Returns: Logarithm of number to base base

LOG(base: B, number: T) → DOUBLE
sql
ParameterTypeRequiredDescription
baseBYesBase of the logarithm; integer or floating-point
numberTYesPositive floating-point number

With:

  • B : Integer or floating-point
  • T : Floating-point type (FLOAT, DOUBLE)

Signature notes:

  • The base may be an integer (e.g. LOG(2, x), LOG(10, x)) or a floating-point number
  • The number argument must be floating-point; cast integers explicitly if needed
  • Both base and number must be positive, and the base must not be 1
  • LOG(base, 1.0) = 0 for any valid base
  • Returns NULL if any input is NULL

Examples

FeatureQL
SELECT
    -- Log base 10 with integer base
    f1 := LOG(10, 100e0),
    -- Another log base 10
    f2 := LOG(10, 1000e0),
    -- Log base 2
    f3 := LOG(2, 8e0),
    -- Log base 2 of 16
    f4 := LOG(2, 16e0),
    -- Floating-point base also accepted
    f5 := LOG(10e0, 100e0),
    -- Log of 1 is always 0
    f6 := LOG(10, 1e0)
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHARf6 VARCHAR
2.03.03.04.02.00.0

Last update at: 2026/06/20 10:08:10