Skip to main content

log (Function)

This function returns the logarithm of the received number as per the given base.

Syntax

<DOUBLE> math:log(<INT|LONG|FLOAT|DOUBLE> number, <INT|LONG|FLOAT|DOUBLE> base)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
numberThe value of the parameter whose base should be changed.INT LONG FLOAT DOUBLENoYes
baseThe base value of the output.INT LONG FLOAT DOUBLENoYes

Example 1

CREATE STREAM InValueStream (number double, base double);

@info(name = 'calculateLogarithmBase')
INSERT INTO OutMediationStream
SELECT math:log(number, base) AS logValue
FROM InValueStream;

The query calculates the logarithm of the given number with the specified base from the InValueStream and directs the results to the output stream OutMediationStream. For example, log(34, 2) returns 5.08746284125034.