Package net.objecthunter.exp4j.extras
Class FunctionsMisc
java.lang.Object
net.objecthunter.exp4j.extras.FunctionsMisc
This class contains a small set of useful functions that don't really fit in
the other categories.
- Since:
- 0.6-riddler
- Author:
- Federico Vera <[email protected]>
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Function
Converts from degrees to radians.static final Function
Equality function.static final double
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 final Function
Returns the Greatest Common Denominator of two numbers.static final Function
Branching function.static final Function
Retrieves the value ofDouble.POSITIVE_INFINITY
.static final Function
Tells if a number isDouble.NaN
.static final Function
Returns the Least Common Multiple of two numbers.static final Function
Returns the largest (closest to positive infinity) of two numbers.static final Function
Returns the smallest (closest to negative infinity) of two numbers.static final Function
Converts from radians to degrees.static final Function
Rounds to the closest integer. -
Method Summary
Modifier and TypeMethodDescriptionstatic Function
getFunction
(String name) Get the function for a given name.static Function[]
Array with all the available functions.
-
Field Details
-
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:
-
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
Retrieves the value ofDouble.POSITIVE_INFINITY
.- Since:
- 0.8-riddler
- See Also:
-
IS_NAN
Tells if a number isDouble.NaN
.- Since:
- 0.8-riddler
- See Also:
-
MIN
Returns the smallest (closest to negative infinity) of two numbers.- Since:
- 0.8-riddler
- See Also:
-
MAX
Returns the largest (closest to positive infinity) of two numbers.- Since:
- 0.8-riddler
- See Also:
-
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:
-
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:
-
ROUND
Rounds to the closest integer.- Since:
- 0.8-riddler
- See Also:
-
DEG2RAD
Converts from degrees to radians.- Since:
- 0.9-riddler
- See Also:
-
RAD2DEG
Converts from radians to degrees.- Since:
- 0.9-riddler
- See Also:
-
EQUALITY_THRESHOLD
public static final double EQUALITY_THRESHOLDThis 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:
-
-
Method Details
-
getFunctions
Array with all the available functions. -
getFunction
Get the function for a given name.
-