The siddhi-execution-math extension is a Siddhi extension that provides useful mathematical functions such as power, round, random, cos, log, etc.
For information on Siddhi and it's features refer Siddhi Documentation.
- Versions 5.x and above with group id
io.siddhi.extension.*
from here. - Versions 4.x and lower with group id
org.wso2.extension.siddhi.*
from here.
Latest API Docs is 5.0.6.
- percentile (Aggregate Function)
This functions returns the pth percentile value of a given argument.
- abs (Function)
This function returns the absolute value of the given parameter. It wraps the
java.lang.Math.abs()
function. - acos (Function)
If -1 <= p1 <= 1, this function returns the arc-cosine (inverse cosine) value of p1.If the domain is invalid, it returns NULL. The value returned is in radian scale. This function wraps the java.lang.Math.acos() function.
- asin (Function)
If -1 <= p1 <= 1, this function returns the arc-sin (inverse sine) value of p1. If the domain is invalid, it returns NULL. The value returned is in radian scale. This function wraps the java.lang.Math.asin() function.
- atan (Function)
1. If a single
p1
is received, this function returns the arc-tangent (inverse tangent) value ofp1
.
2. Ifp1
is received along with an optionalp1
, it considers them as x and y coordinates and returns the arc-tangent (inverse tangent) value.
The returned value is in radian scale. This function wraps thejava.lang.Math.atan()
function. - bin (Function)
This function returns a string representation of the p1 argument, that is of either 'integer' or 'long' data type, as an unsigned integer in base 2. It wraps the
java.lang.Integer.toBinaryString
and java.lang.Long.toBinaryString` methods. - cbrt (Function)
This function returns the cube-root of 'p1' which is in radians. It wraps the
java.lang.Math.cbrt()
function. - ceil (Function)
This function returns the smallest double value, i.e., the closest to the negative infinity, that is greater than or equal to the
p1
argument, and is equal to a mathematical integer. It wraps thejava.lang.Math.ceil()
method. - conv (Function)
This function converts
a
from thefromBase
base to thetoBase
base. - copySign (Function)
This function returns a value of an input with the received
magnitude
andsign
of another input. It wraps thejava.lang.Math.copySign()
function. - cos (Function)
This function returns the cosine of
p1
which is in radians. It wraps thejava.lang.Math.cos()
function. - cosh (Function)
This function returns the hyperbolic cosine of
p1
which is in radians. It wraps thejava.lang.Math.cosh()
function. - e (Function)
This function returns the
java.lang.Math.E
constant, which is the closest double value to e, where e is the base of the natural logarithms. - exp (Function)
This function returns the Euler's number
e
raised to the power ofp1
. It wraps thejava.lang.Math.exp()
function. - floor (Function)
This function wraps the
java.lang.Math.floor()
function and returns the largest value, i.e., closest to the positive infinity, that is less than or equal top1
, and is equal to a mathematical integer. - getExponent (Function)
This function returns the unbiased exponent that is used in the representation of
p1
. This function wraps thejava.lang.Math.getExponent()
function. - hex (Function)
This function wraps the
java.lang.Double.toHexString() function. It returns a hexadecimal string representation of the input,
p1`. - isInfinite (Function)
This function wraps the
java.lang.Float.isInfinite()
andjava.lang.Double.isInfinite()
and returnstrue
ifp1
is infinitely large in magnitude andfalse
if otherwise. - isNan (Function)
This function wraps the
java.lang.Float.isNaN()
andjava.lang.Double.isNaN()
functions and returnstrue
ifp1
is NaN (Not-a-Number), and returnsfalse
if otherwise. - ln (Function)
This function returns the natural logarithm (base e) of
p1
. - log (Function)
This function returns the logarithm of the received
number
as per the givenbase
. - log10 (Function)
This function returns the base 10 logarithm of
p1
. - log2 (Function)
This function returns the base 2 logarithm of
p1
. - max (Function)
This function returns the greater value of
p1
andp2
. - min (Function)
This function returns the smaller value of
p1
andp2
. - oct (Function)
This function converts the input parameter
p1
to octal. - parseDouble (Function)
This function returns the double value of the string received.
- parseFloat (Function)
This function returns the float value of the received string.
- parseInt (Function)
This function returns the integer value of the received string.
- parseLong (Function)
This function returns the long value of the string received.
- pi (Function)
This function returns the
java.lang.Math.PI
constant, which is the closest value to pi, i.e., the ratio of the circumference of a circle to its diameter. - power (Function)
This function raises the given value to a given power.
- rand (Function)
This returns a stream of pseudo-random numbers when a sequence of calls are sent to the
rand()
. Optionally, it is possible to define a seed, i.e.,rand(seed)
using which the pseudo-random numbers are generated. These functions internally use thejava.util.Random
class. - round (Function)
This function returns the value of the input argument rounded off to the closest integer/long value.
- signum (Function)
This returns +1, 0, or -1 for the given positive, zero and negative values respectively. This function wraps the
java.lang.Math.signum()
function. - sin (Function)
This returns the sine of the value given in radians. This function wraps the
java.lang.Math.sin()
function. - sinh (Function)
This returns the hyperbolic sine of the value given in radians. This function wraps the
java.lang.Math.sinh()
function. - sqrt (Function)
This function returns the square-root of the given value. It wraps the
java.lang.Math.sqrt()
s function. - tan (Function)
This function returns the tan of the given value in radians. It wraps the
java.lang.Math.tan()
function. - tanh (Function)
This function returns the hyperbolic tangent of the value given in radians. It wraps the
java.lang.Math.tanh()
function. - toDegrees (Function)
This function converts the value given in radians to degrees. It wraps the
java.lang.Math.toDegrees()
function. - toRadians (Function)
This function converts the value given in degrees to radians. It wraps the
java.lang.Math.toRadians()
function.
There are no other dependencies needed for this extension.
For installing this extension on various siddhi execution environments refer Siddhi documentation section on adding extensions.
-
We encourage users to ask questions and get support via StackOverflow, make sure to add the
siddhi
tag to the issue for better response. -
If you find any issues related to the extension please report them on the issue tracker.
-
For production support and other contribution related information refer Siddhi Community documentation.