This topic describes how to use the mathematical function LOG in Realtime Compute.

Syntax

DOUBLE LOG(DOUBLE base, DOUBLE x)
DOUBLE LOG(DOUBLE x)

Input parameters

Parameter Data type
base DOUBLE
x DOUBLE

Description

Returns a natural logarithm of x with a specified base. The return value is a logarithm of the DOUBLE type. If the base is not specified, a natural logarithm with base x is returned.

Example

  • Test data
    ID (INT) BASE (DOUBLE) X (DOUBLE)
    1 10.0 100.0
    2 2.0 8.0
  • Test statements
    SELECT id, LOG(base, x) as dou1, LOG(2) as dou2
    FROM T1;       
  • Test results
    ID (INT) dou1 (DOUBLE) dou2 (DOUBLE)
    1 2.0 0.6931471805599453
    2 3.0 0.6931471805599453