LOG( ) function

Returns the logarithm (base 10) of a numeric expression or field value with a specified number of decimal places.

Syntax

LOG(number, decimals)

Parameters

Name Type Description
number numeric

The value to find the logarithm for.

decimals numeric The number of decimal places for the return value.

Output

Numeric.

Examples

Basic examples

Returns 3.0000:

LOG(1000, 4)

Returns 4.86:

LOG(72443, 2)

Advanced examples

Finding the cube root

Creates a field that is the cube root of the field X to two decimal places:

DEFINE FIELD Cube_root COMPUTED EXP(LOG(X, 6) / 3, 2)

Note

You determine the nth root by dividing the log of the value by n and taking the exponential value of the result.

Remarks

How it works

The logarithm of a number is the exponent (or power) of 10 needed to generate that number. Therefore, the logarithm of 1000 is 3.

Related functions

The LOG( ) function is the inverse of the EXP( ) function.