com.ibm.streams.function.samples.math
Class MathFunctions
- java.lang.Object
-
- com.ibm.streams.function.samples.math.MathFunctions
-
public class MathFunctions extends java.lang.Object
Sample mathematical SPL Java native functions. Functions that call static methods injava.lang.Math
ororg.apache.commons.math.util.MathUtils
and are annotated withFunction
to expose them as SPL native functions.
The SPL namespace of the functions is defined by theNamespace
annotation applied to this class's packagecom.ibm.streams.function.samples.math
.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static double
cosh(double v)
Returns the hyperbolic cosine of a double value.static long
factorial(int n)
Returnsn!
(n
factorial).static double
hypot(double x, double y)
Returns√(x2 + y2)
.static double
sinh(double v)
Returns the hyperbolic sine of a double value.static double
tanh(double v)
Returns the hyperbolic tangent of a double value.
-
-
-
Method Detail
-
cosh
@Function(description="Returns the hyperbolic cosine of a `float64` value.") public static double cosh(double v)
Returns the hyperbolic cosine of a double value.- Parameters:
v
- The value to calculate the hyperbolic cosine of.- Returns:
- The hyperbolic cosine of
v
.
-
sinh
@Function(description="Returns the hyperbolic sine of a `float64` value.") public static double sinh(double v)
Returns the hyperbolic sine of a double value.- Parameters:
v
- The value to calculate the hyperbolic sine of.- Returns:
- The hyperbolic sine of
v
.
-
tanh
@Function(description="Returns the hyperbolic tangent of a `float64` value.") public static double tanh(double v)
Returns the hyperbolic tangent of a double value.- Parameters:
v
- The value to calculate the hyperbolic tangent of.- Returns:
- The hyperbolic tangent of
v
.
-
hypot
@Function(name="hypotenuse", description="Returns the square root of `x` squared plus `y` squared.") public static double hypot(double x, double y)
Returns√(x2 + y2)
.- Parameters:
x
- a valuey
- a value- Returns:
√(x2 + y2)
-
factorial
@Function(description="Returns `n!` (`n` factorial).") public static long factorial(int n)
Returnsn!
(n
factorial).- Parameters:
n
- Value to calculate the factorial of.- Returns:
n!
-
-