public abstract class DoublePrecisionContext extends Object implements Comparator<Double>
| Constructor and Description |
|---|
DoublePrecisionContext() |
| Modifier and Type | Method and Description |
|---|---|
abstract int |
compare(double a,
double b)
Compare two double values.
|
int |
compare(Double a,
Double b) |
boolean |
eq(double a,
double b)
Return true if the given values are considered equal to each other.
|
boolean |
eqZero(double n)
Return true if the given value is considered equal to zero.
|
abstract double |
getMaxZero()
Get the largest positive double value that is still considered equal
to zero by this instance.
|
boolean |
gt(double a,
double b)
Return true if the first argument is strictly greater than the second.
|
boolean |
gte(double a,
double b)
Return true if the first argument is greater than or equal to the second.
|
boolean |
lt(double a,
double b)
Return true if the first argument is strictly less than the second.
|
boolean |
lte(double a,
double b)
Return true if the first argument is less than or equal to the second.
|
int |
sign(double a)
Return the sign of the argument: 0 if the value is considered equal to
zero, -1 if less than 0, and +1 if greater than 0.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcomparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongpublic boolean eq(double a,
double b)
a - first valueb - second valuepublic boolean eqZero(double n)
context.eq(n, 0.0) but with a more explicit
method name.n - the number to compare to zeropublic boolean lt(double a,
double b)
a - first valueb - second valuea < bpublic boolean lte(double a,
double b)
a - first valueb - second valuea <= bpublic boolean gt(double a,
double b)
a - first valueb - second valuea > bpublic boolean gte(double a,
double b)
a - first valueb - second valuea >= bpublic int sign(double a)
a - number to determine the sign ofpublic int compare(Double a, Double b)
compare in interface Comparator<Double>public abstract int compare(double a,
double b)
0 if the arguments are considered equal,
-1 if a < b,
+1 if a > b or if either value is NaN.
a - first valueb - second value0 if the values are considered equal, -1 if the
first is smaller than the second, 1 is the first is larger
than the second or either value is NaN.public abstract double getMaxZero()
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.