LN()

All functions > MATH > LN()

Returns the natural logarithm (base e) of a number.

Signatures

Natural logarithm

Returns: Natural logarithm of the input

LN(number: T) → DOUBLE
sql
ParameterTypeRequiredDescription
numberTYesPositive floating-point number

With:

  • T : Floating-point type (FLOAT, DOUBLE)

Signature notes:

  • Only defined for positive numbers
  • LN(1.0) = 0, LN(e) = 1
  • Returns NULL if the input is NULL
  • Returns negative infinity for 0, NaN for negative numbers
  • Inverse of EXP: LN(EXP(x)) = x

Examples

FeatureQL
SELECT
    f1 := LN(1.0E0), -- ln(1) is 0
    f2 := LN(2.718281828459045E0), -- ln(e) is 1
    f3 := LN(10.0E0), -- Natural log of 10
    f4 := LN(0.5E0) -- Natural log below 1 is negative
;
Result
f1 VARCHARf2 VARCHARf3 VARCHARf4 VARCHAR
0.01.02.302585092994046-0.6931471805599453

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