Math extension provides basic mathematical functions such as calculating absolute value, sin, cos, tan, base conversion, parsing, etc. Following are the functions of the Math extension.
...
Syntax | <double> math:abs(<float|double> p1) |
---|---|
Extension Type | Function |
Description | Returns the absolute value of p1 . This function wraps the java.lang.Math.abs() function. |
Examples | Both the following queries return 3 since the absolute value of both
|
acos function
Syntax | <double> math:acos(<float|double> p1) |
---|---|
Extension Type | Function |
Description | If -1 <= p1 <= 1, this function returns the arc-cosine (inverse cosine) of p1 . If not, it returns NULL. The return value is in radian scale. This function wraps the java.lang.Math.acos() function. |
Example | acos(0.5) returns 1.0471975511965979 . |
...
Syntax | <double> math:asin (<float|double> p1) |
---|---|
Extension Type | Function |
Description | If -1 <= p1 <= 1, this function returns the arc-sin (inverse sine) of p1 . If not, it returns NULL . The return value is in radian scale. This function wraps the java.lang.Math.asin() function. |
Example | asin(0.5) returns 0.5235987755982989 . |
atan function
Syntax | <double> math:atan(<int|long|float|double> p1) |
---|---|
Extension Type | Function |
Description | Returns the arc-tangent (inverse tangent) of p1 . The return value is in radian scale. This function wraps the java.lang.Math.atan() function. |
Examples | atan(6d) returns 1.4056476493802699 . |
...
Syntax | <double> math:cbrt(<int|long|float|double> p1) |
---|---|
Extension Type | Function |
Description | Returns the cube-root of p1 (p1 is in radians). This function wraps the java.lang.Math.cbrt() function. |
Example | cbrt(17d) returns 2.5712815906582356 . |
e function
Syntax | <double> math:e() |
---|---|
Extension Type | Function |
Description | Returns the java.lang.Math.E constant, which is the closest double value to e (which is the base of the natural logarithms). |
Example | e() returns 2.7182818284590452354 . |
...
Is Not A Number function
Syntax | < boolean> math:isNan(<float|double> p1) |
---|---|
Extension Type | Function |
Description | This function wraps the java.lang.Float.isNaN() and java.lang.Double.isNaN() functions that return true if p1 is a NaN (Not-a-Number) value, or return false otherwise. |
Example | isNan(java.lang.Math.log(-12d) ) returns true . |
...
Syntax | <double> math:percentile (<int|long|float|double> arg, <double> p) |
---|---|
Extension Type | Function |
Description | Returns the p th percentile value of the arg values. |
Example | from inputStream#window.length(100) select math:percentile(temperature, 97.0) as percentile insert into outputStream; returns 97th percentile value of last 100 |
...
Syntax | <double> math:pi ( ) |
---|---|
Extension Type | Function |
Description | 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). |
Example | pi() always returns 3.141592653589793 . |
Power function
Syntax | <double> math:power ( < int|long|float|double> value, <int|long|float|double> toPower ) |
---|---|
Extension Type | Function |
Description | Returns value raised to the power of toPower . |
Example | power(5.6d, 3.0d) returns 175.61599999999996 . |
...
Syntax | <double> math:sin (< int|long|float|double > p1) |
---|---|
Extension Type | Function |
Description | Returns the sine of p1 (p1 is in radians). This function wraps the java.lang.Math.sin() function. |
Example | sin(6d ) returns -0.27941549819892586. |
sinh function
Syntax | <double> math:sinh (< int|long|float|double > p1) |
---|---|
Extension Type | Function |
Description | Returns the hyperbolic sine of p1 (p1 is in radians). This function wraps the java.lang.Math.sinh() function. |
Example | sinh(6d) returns 201.71315737027922 . |
...
Syntax | <double> math:sqrt (< int|long|float|double > p1) |
---|---|
Extension Type | Function |
Description | Returns the square-root of p1 . This function wraps the java.lang.Math.sqrt() function. |
Example | sqrt(4d) returns 2 . |
tan function
Syntax | <double> math:tan (< int|long|float|double > p1) |
---|---|
Extension Type | Function |
Description | Returns the tan of p1 (p1 is in radians). This function wraps the java.lang.Math.tan() function. |
Example | tan(6d) returns -0.29100619138474915 . |
...