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

Syntax

DOUBLE LOG2(DOUBLE x)  

Input parameters

Parameter Data type
x DOUBLE

Description

Returns a binary logarithm. If x is null, the return value is null. If x is negative, an error occurs.

Example

  • Test data
    id (INT) X (INT)
    1 8
    2 2
  • Test statements
    SELECT id, log2(x) as dou1
    FROM T1;          
  • Test results
    id (INT) dou1 (DOUBLE)
    1 3.0
    2 1.0