|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjaitools.numeric.DoubleComparison
public class DoubleComparison
Provides static method to compare double values with either a default or specified tolerance.
| Field Summary | |
|---|---|
static double |
TOL
Default tolerance for comparisons: 1.0e-8 |
| Constructor Summary | |
|---|---|
DoubleComparison()
|
|
| Method Summary | |
|---|---|
static int |
dcomp(double x1,
double x2)
Compares two values using the default tolerance. |
static int |
dcomp(double x1,
double x2,
double tol)
Compares two values using the user-specified tolerance |
static boolean |
dequal(double x1,
double x2)
Tests if two double values are equal within the default tolerance. |
static boolean |
dequal(double x1,
double x2,
double tol)
Tests if two double values are equal within the specified tolerance. |
static boolean |
dzero(double x)
Tests if the given value is 0 within the default tolerance. |
static boolean |
dzero(double x,
double tol)
Tests if the given value is 0 within the user-specified tolerance. |
static int |
toInt(double x)
Converts a double value to integer taking into account the default tolerance when checking if it is zero, ie. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final double TOL
| Constructor Detail |
|---|
public DoubleComparison()
| Method Detail |
|---|
public static boolean dzero(double x)
x - the value
true if zero; false otherwise
public static boolean dzero(double x,
double tol)
x - the valuetol - the user-specified tolerance (assumed to be positive)
true if zero; false otherwise
public static int dcomp(double x1,
double x2)
x1 - first valuex2 - second value
public static int dcomp(double x1,
double x2,
double tol)
x1 - first valuex2 - second valuetol - the tolerance
public static boolean dequal(double x1,
double x2)
dzero(x1 - x2).
x1 - first valuex2 - second value
true if equal; false otherwise
public static boolean dequal(double x1,
double x2,
double tol)
dzero(x1 - x2, tol).
x1 - first valuex2 - second valuetol - the tolerance
true if equal; false otherwisepublic static int toInt(double x)
x - the value to convert
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||