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
    f1 := LOG(10, 100E0), -- Log base 10 with integer base
    f2 := LOG(10, 1000E0), -- Another log base 10
    f3 := LOG(2, 8E0), -- Log base 2
    f4 := LOG(2, 16E0), -- Log base 2 of 16
    f5 := LOG(10E0, 100E0), -- Floating-point base also accepted
    f6 := LOG(10, 1E0) -- Log of 1 is always 0
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHARf5 VARCHARf6 VARCHAR
2.03.03.04.02.00.0

Last update at: 2026/05/26 17:22:09