Package net.objecthunter.exp4j.extras
Class FunctionsMisc
- java.lang.Object
-
- net.objecthunter.exp4j.extras.FunctionsMisc
-
public final class FunctionsMisc extends java.lang.Object
This class contains a small set of useful functions that don't really fit in the other categories.- Since:
- 0.6-riddler
-
-
Field Summary
Fields Modifier and Type Field Description static Function
EQUAL
Equality function.static double
EQUALITY_THRESHOLD
This is the threshold used to consider values equal, that is, if two valuesa
andb
are separated by less than this threshold they will be considered to be equal, it has a default value of 1.0E-12static Function
GCD
Returns the Greatest Common Denominator of two numbers.static Function
IF
Branching function.static Function
INFINITY
Retrieves the value ofDouble.POSITIVE_INFINITY
.static Function
IS_NAN
Tells if a number isDouble.NaN
.static Function
LCM
Returns the Least Common Multiple of two numbers.static Function
MAX
Returns the largest (closest to positive infinity) of two numbers.static Function
MIN
Returns the smallest (closest to negative infinity) of two numbers.static Function
ROUND
Rounds to closest integer.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Function
getFunction(java.lang.String name)
Get the function for a given name.static Function[]
getFunctions()
Array with all the available functions.
-
-
-
Field Detail
-
EQUAL
public static final Function EQUAL
Equality function.The test is performed using a threshold given by
Operator.BOOLEAN_THRESHOLD
.This function has two argument
equal(a, b)
where:a
: First value to testb
: Second value to test
- Since:
- 0.6-riddler
- See Also:
Operator.BOOLEAN_THRESHOLD
-
IF
public static final Function IF
Branching function.This function has three argument
if(exp, v_true, v_false)
where:exp
: Boolean expressionv_true
: Value if truev_false
: Value if false
-
INFINITY
public static final Function INFINITY
Retrieves the value ofDouble.POSITIVE_INFINITY
.- Since:
- 0.8-riddler
- See Also:
Double.POSITIVE_INFINITY
,Double.NEGATIVE_INFINITY
-
IS_NAN
public static final Function IS_NAN
Tells if a number isDouble.NaN
.- Since:
- 0.8-riddler
- See Also:
Double.isNaN(double)
-
MIN
public static final Function MIN
Returns the smallest (closest to negative infinity) of two numbers.- Since:
- 0.8-riddler
- See Also:
Math.min(double, double)
-
MAX
public static final Function MAX
Returns the largest (closest to positive infinity) of two numbers.- Since:
- 0.8-riddler
- See Also:
Math.max(double, double)
-
GCD
public static final Function GCD
Returns the Greatest Common Denominator of two numbers.The numbers WILL be rounded using
Math.round(double)
before the analysis.If the resulting value is out of the range of the
long
type, then anArithmeticException
is thrown.- Since:
- 0.8-riddler
- See Also:
Functions.FLOOR
,Functions.CEIL
,ROUND
,LCM
-
LCM
public static final Function LCM
Returns the Least Common Multiple of two numbers.The numbers WILL be rounded using
Math.round(double)
before the analysis.If the resulting value is out of the range of the
long
type, then anArithmeticException
is thrown.- Since:
- 0.8-riddler
- See Also:
Functions.FLOOR
,Functions.CEIL
,ROUND
,GCD
-
ROUND
public static final Function ROUND
Rounds to closest integer.- Since:
- 0.8-riddler
- See Also:
Functions.FLOOR
,Functions.CEIL
,Math.round(double)
-
EQUALITY_THRESHOLD
public static final double EQUALITY_THRESHOLD
This is the threshold used to consider values equal, that is, if two valuesa
andb
are separated by less than this threshold they will be considered to be equal, it has a default value of 1.0E-12- See Also:
- Constant Field Values
-
-
Method Detail
-
getFunctions
public static Function[] getFunctions()
Array with all the available functions.
-
-