Previous Topic Next topic Print topic


LOG2 Function

Purpose

Returns the logarithm of an arithmetic expression to the base 2.

Syntax

LOG2(x)

Parameters

x is a floating-point value greater than zero.

Description

The LOG2 function returns the logarithm of x to the base 2. Note that LOG2(x) is the inverse of 2**x, that is, 2**LOG2(x) = x = LOG2(2**x).

The result has the same data type as x.

Examples

LOG2(0.5)    /* returns -1 */

Restrictions

An LOG2 operation on floating-point decimal data is actually performed using the floating-point binary operation. Thus, the range of the operands and the result of the operation are limited to the ranges for floating-point binary numbers.

Previous Topic Next topic Print topic