|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.util.Precision
public class Precision
Utilities for comparing numbers.
| Method Summary | |
|---|---|
static int |
compareTo(double x,
double y,
double eps)
Compares two numbers given some amount of allowed error. |
static int |
compareTo(double x,
double y,
int maxUlps)
Compares two numbers given some amount of allowed error. |
static boolean |
equals(double x,
double y)
Returns true iff they are equal as defined by equals(x, y, 1). |
static boolean |
equals(double x,
double y,
double eps)
Returns true if there is no double value strictly between the
arguments or the difference between them is within the range of allowed
error (inclusive). |
static boolean |
equals(double x,
double y,
int maxUlps)
Returns true if both arguments are equal or within the range of allowed error (inclusive). |
static boolean |
equals(float x,
float y)
Returns true iff they are equal as defined by equals(x, y, 1). |
static boolean |
equals(float x,
float y,
float eps)
Returns true if both arguments are equal or within the range of allowed error (inclusive). |
static boolean |
equals(float x,
float y,
int maxUlps)
Returns true if both arguments are equal or within the range of allowed error (inclusive). |
static boolean |
equalsIncludingNaN(double x,
double y)
Returns true if both arguments are NaN or neither is NaN and they are equal as defined by equals(x, y, 1). |
static boolean |
equalsIncludingNaN(double x,
double y,
double eps)
Returns true if both arguments are NaN or are equal or within the range of allowed error (inclusive). |
static boolean |
equalsIncludingNaN(double x,
double y,
int maxUlps)
Returns true if both arguments are NaN or if they are equal as defined by equals(x, y, maxUlps). |
static boolean |
equalsIncludingNaN(float x,
float y)
Returns true if both arguments are NaN or neither is NaN and they are equal as defined by equals(x, y, 1). |
static boolean |
equalsIncludingNaN(float x,
float y,
float eps)
Returns true if both arguments are NaN or are equal or within the range of allowed error (inclusive). |
static boolean |
equalsIncludingNaN(float x,
float y,
int maxUlps)
Returns true if both arguments are NaN or if they are equal as defined by equals(x, y, maxUlps). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static int compareTo(double x,
double y,
double eps)
x - the first numbery - the second numbereps - the amount of error to allow when checking for equality
equals(x, y, eps)equals(x, y, eps) && x < yequals(x, y, eps) && x > y
public static int compareTo(double x,
double y,
int maxUlps)
(maxUlps - 1)
(or fewer) floating point numbers between them, i.e. two adjacent floating
point numbers are considered equal.
Adapted from
Bruce Dawson
x - first valuey - second valuemaxUlps - (maxUlps - 1) is the number of floating point
values between x and y.
equals(x, y, maxUlps)equals(x, y, maxUlps) && x < yequals(x, y, maxUlps) && x > y
public static boolean equals(float x,
float y)
equals(x, y, 1).
x - first valuey - second value
true if the values are equal.
public static boolean equalsIncludingNaN(float x,
float y)
equals(x, y, 1).
x - first valuey - second value
true if the values are equal or both are NaN.
public static boolean equals(float x,
float y,
float eps)
x - first valuey - second valueeps - the amount of absolute error to allow.
true if the values are equal or within range of each other.
public static boolean equalsIncludingNaN(float x,
float y,
float eps)
x - first valuey - second valueeps - the amount of absolute error to allow.
true if the values are equal or within range of each other,
or both are NaN.
public static boolean equals(float x,
float y,
int maxUlps)
(maxUlps - 1)
(or fewer) floating point numbers between them, i.e. two adjacent floating
point numbers are considered equal.
Adapted from
Bruce Dawson
x - first valuey - second valuemaxUlps - (maxUlps - 1) is the number of floating point
values between x and y.
true if there are fewer than maxUlps floating
point values between x and y.
public static boolean equalsIncludingNaN(float x,
float y,
int maxUlps)
equals(x, y, maxUlps).
x - first valuey - second valuemaxUlps - (maxUlps - 1) is the number of floating point
values between x and y.
true if both arguments are NaN or if there are less than
maxUlps floating point values between x and y.
public static boolean equals(double x,
double y)
equals(x, y, 1).
x - first valuey - second value
true if the values are equal.
public static boolean equalsIncludingNaN(double x,
double y)
equals(x, y, 1).
x - first valuey - second value
true if the values are equal or both are NaN.
public static boolean equals(double x,
double y,
double eps)
true if there is no double value strictly between the
arguments or the difference between them is within the range of allowed
error (inclusive).
x - First value.y - Second value.eps - Amount of allowed absolute error.
true if the values are two adjacent floating point
numbers or they are within range of each other.
public static boolean equalsIncludingNaN(double x,
double y,
double eps)
x - first valuey - second valueeps - the amount of absolute error to allow.
true if the values are equal or within range of each other,
or both are NaN.
public static boolean equals(double x,
double y,
int maxUlps)
(maxUlps - 1)
(or fewer) floating point numbers between them, i.e. two adjacent floating
point numbers are considered equal.
Adapted from
Bruce Dawson
x - first valuey - second valuemaxUlps - (maxUlps - 1) is the number of floating point
values between x and y.
true if there are fewer than maxUlps floating
point values between x and y.
public static boolean equalsIncludingNaN(double x,
double y,
int maxUlps)
equals(x, y, maxUlps).
x - first valuey - second valuemaxUlps - (maxUlps - 1) is the number of floating point
values between x and y.
true if both arguments are NaN or if there are less than
maxUlps floating point values between x and y.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||