LOG10 scalar function

The LOG10 function returns the common logarithm (base 10) of a number.

Read syntax diagramSkip visual syntax diagramLOG10(expression)

The schema is SYSIBM. (The SYSFUN version of the LOG10 function continues to be available.)

expression
An expression that returns a value of any built-in numeric data type. If the value is of decimal floating-point data type, the operation is performed in decimal floating-point; otherwise, the value is converted to double-precision floating-point for processing by the function. The value of the argument must be greater than zero (SQLSTATE 22003).

If the argument is DECFLOAT(n), the result is DECFLOAT(n); otherwise, the result is a double-precision floating-point number. The result can be null; if the argument is null, the result is the null value.

Notes

  • Results involving DECFLOAT special values: For decimal floating-point values, the special values are treated as follows:
    • LOG10(NaN) returns NaN.
    • LOG10(-NaN) returns -NaN.
    • LOG10(Infinity) returns Infinity.
    • LOG10(-Infinity) returns NaN and a warning.
    • LOG10(sNaN) returns NaN and a warning.
    • LOG10(-sNaN) returns -NaN and a warning.
    • LOG10(DECFLOAT('0') returns -Infinity.

Example

Assume that L is a DECIMAL(4,2) host variable with a value of 31.62.
   VALUES LOG10(:L)
Returns the DOUBLE value +1.49996186559619E+000.