log10()

The log10() function returns the common logarithm (base 10) of the input value.

Syntax

log10(NUM_EXPR)

Parameters

NUM_EXPR
A numeric expression whose base-10 logarithm is to be computed.

Description

The log10() function applies Math.log10() to the input and returns the result as a 64-bit double. If the input is a Number type, it is internally converted using doubleValue() before processing.

Returns null if the input is null or not a number. Returns negative infinity (-Infinity) if the input is 0. Returns NaN if the input is negative.

Error codes

N/A

Usage examples

  1. Calculate the base-10 logarithm of 10.

    json "{'val': 10}" | eval result = log10(val)
    | # result: 1.0
    
  2. Calculate the base-10 logarithm of 100.

    json "{'val': 100}" | eval result = log10(val)
    | # result: 2.0
    
  3. NULL input

    json "{'val': null}" | eval result = log10(val)
    | # result: null
    

Compatibility

The log10() function is available since before Sonar 4.0.