public class NumberUtil
extends java.lang.Object
Constructor and Description |
---|
NumberUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
Factorial(int n)
This function implements Factorial N.
|
static boolean |
IsValid(double dbl)
Checks if the input double is Infinite or NaN
|
static boolean |
IsValid(double[] adbl)
Checks if the input double array contains an Infinite or an NaN
|
static int |
NCK(int n,
int k)
This function implements N choose K.
|
static int |
NPK(int n,
int k)
This function implements N Permute K.
|
static boolean |
Print1DArray(java.lang.String strName,
double[] adblA,
boolean bBailOnNaN)
Print the contents of the 1D array
|
static boolean |
Print2DArray(java.lang.String strName,
double[][] aadblA,
boolean bBailOnNaN)
Print the contents of the 2D array
|
static boolean |
WithinTolerance(double dbl1,
double dbl2)
Compares and checks if the two input numbers fall within a specified tolerance
|
static boolean |
WithinTolerance(double dbl1,
double dbl2,
double dblAbsoluteTolerance,
double dblRelativeTolerance)
Compares and checks if the two input numbers fall within a specified tolerance
|
public static final boolean IsValid(double dbl)
dbl
- Input doublepublic static final boolean IsValid(double[] adbl)
adbl
- Input double arraypublic static final boolean WithinTolerance(double dbl1, double dbl2, double dblAbsoluteTolerance, double dblRelativeTolerance)
dbl1
- Number #1dbl2
- Number #2dblAbsoluteTolerance
- Absolute TolerancedblRelativeTolerance
- Relative Tolerancepublic static final boolean WithinTolerance(double dbl1, double dbl2)
dbl1
- Number #1dbl2
- Number #2public static final int Factorial(int n)
n
- Npublic static final int NPK(int n, int k)
n
- Nk
- Kpublic static final int NCK(int n, int k)
n
- Nk
- Kpublic static final boolean Print1DArray(java.lang.String strName, double[] adblA, boolean bBailOnNaN)
strName
- Label NameadblA
- The 1D arraybBailOnNaN
- Bail on encountering an NaNpublic static final boolean Print2DArray(java.lang.String strName, double[][] aadblA, boolean bBailOnNaN)
strName
- Label NameaadblA
- The 2D arraybBailOnNaN
- Bail on encountering an NaN