public final class FloatingPoint extends Object
float
and
double
.Modifier and Type | Field and Description |
---|---|
static double |
EPSILON_DEFAULT_DOUBLE
The default epsilon used for
double s which has a value of 1E-9. |
static float |
EPSILON_DEFAULT_FLOAT
The default epsilon used for
float s which has a value of 1E-5. |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(double value1,
double value2)
|
static boolean |
equals(double value1,
double value2,
double epsilon)
Returns whether
value1 and value2 are equal given the
specified epsilon . |
static boolean |
equals(float value1,
float value2)
|
static boolean |
equals(float value1,
float value2,
float epsilon)
Returns whether
value1 and value2 are equal given the
specified epsilon . |
static boolean |
greaterThan(double value1,
double value2)
Returns whether
value1 is greater than value2 . |
static boolean |
greaterThan(double value1,
double value2,
double epsilon)
Returns whether
value1 is greater than value2 . |
static boolean |
greaterThan(float value1,
float value2)
Returns whether
value1 is greater than value2 . |
static boolean |
greaterThan(float value1,
float value2,
float epsilon)
Returns whether
value1 is greater than value2 . |
static boolean |
greaterThanOrEqual(double value1,
double value2)
Returns whether
value1 is greater than or equal to
value2 . |
static boolean |
greaterThanOrEqual(double value1,
double value2,
double epsilon)
Returns whether
value1 is greater than or equal to
value2 . |
static boolean |
greaterThanOrEqual(float value1,
float value2)
Returns whether
value1 is greater than or equal to
value2 . |
static boolean |
greaterThanOrEqual(float value1,
float value2,
float epsilon)
Returns whether
value1 is greater than or equal to
value2 . |
static boolean |
lessThan(double value1,
double value2)
Returns whether
value1 is less than value2 . |
static boolean |
lessThan(double value1,
double value2,
double epsilon)
Returns whether
value1 is less than value2 . |
static boolean |
lessThan(float value1,
float value2)
Returns whether
value1 is less than value2 . |
static boolean |
lessThan(float value1,
float value2,
float epsilon)
Returns whether
value1 is less than value2 . |
static boolean |
lessThanOrEqual(double value1,
double value2)
Returns whether
value1 is less than or equal to value2 . |
static boolean |
lessThanOrEqual(double value1,
double value2,
double epsilon)
Returns whether
value1 is less than or equal to value2 . |
static boolean |
lessThanOrEqual(float value1,
float value2)
Returns whether
value1 is less than or equal to value2 . |
static boolean |
lessThanOrEqual(float value1,
float value2,
float epsilon)
Returns whether
value1 is less than or equal to value2 . |
public static final float EPSILON_DEFAULT_FLOAT
float
s which has a value of 1E-5.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
public static final double EPSILON_DEFAULT_DOUBLE
double
s which has a value of 1E-9.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
public static boolean equals(float value1, float value2, float epsilon)
value1
and value2
are equal given the
specified epsilon
.value1
- the first value to comparevalue2
- the second value to compareepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
and value2
are within
the specified epsilon
of each other; false
otherwisepublic static boolean equals(float value1, float value2)
value1
and value2
are equal using the
default epsilon EPSILON_DEFAULT_FLOAT
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the first value to comparevalue2
- the second value to comparetrue
if value1
and value2
are within
the default epsilon of each other; false
otherwisepublic static boolean equals(double value1, double value2, double epsilon)
value1
and value2
are equal given the
specified epsilon
.value1
- the first value to comparevalue2
- the second value to compareepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
and value2
are within
the specified epsilon
of each other; false
otherwisepublic static boolean equals(double value1, double value2)
value1
and value2
are equal using the
default epsilon EPSILON_DEFAULT_DOUBLE
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the first value to comparevalue2
- the second value to comparetrue
if value1
and value2
are within
the default epsilon of each other; false
otherwisepublic static boolean lessThan(float value1, float value2, float epsilon)
value1
is less than value2
. The
epsilon
is used to determine if the values are equal, in which
case it will return false
.value1
- the value to check if it is less than value2
value2
- the value to check if value1
is less thanepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is less than value2
;
false
otherwiseequals(float, float, float)
public static boolean lessThan(float value1, float value2)
value1
is less than value2
. The
default epsilon EPSILON_DEFAULT_FLOAT
is used to determine if
the values are equal, in which case it will return false
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is less than value2
value2
- the value to check if value1
is less thantrue
if value1
is less than value2
;
false
otherwiseequals(float, float)
public static boolean lessThan(double value1, double value2, double epsilon)
value1
is less than value2
. The
epsilon
is used to determine if the values are equal, in which
case it will return false
.value1
- the value to check if it is less than value2
value2
- the value to check if value1
is less thanepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is less than value2
;
false
otherwiseequals(double, double, double)
public static boolean lessThan(double value1, double value2)
value1
is less than value2
. The
default epsilon EPSILON_DEFAULT_DOUBLE
is used to determine if
the values are equal, in which case it will return false
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is less than value2
value2
- the value to check if value1
is less thantrue
if value1
is less than value2
;
false
otherwiseequals(double, double)
public static boolean greaterThan(float value1, float value2, float epsilon)
value1
is greater than value2
. The
epsilon
is used to determine if the values are equal, in which
case it will return false
.value1
- the value to check if it is greater than value2
value2
- the value to check if value1
is greater thanepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is greater than value2
;
false
otherwiseequals(float, float, float)
public static boolean greaterThan(float value1, float value2)
value1
is greater than value2
. The
default epsilon EPSILON_DEFAULT_FLOAT
is used to determine if
the values are equal, in which case it will return false
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is greater than value2
value2
- the value to check if value1
is greater thantrue
if value1
is greater than value2
;
false
otherwiseequals(float, float)
public static boolean greaterThan(double value1, double value2, double epsilon)
value1
is greater than value2
. The
epsilon
is used to determine if the values are equal, in which
case it will return false
.value1
- the value to check if it is greater than value2
value2
- the value to check if value1
is greater thanepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is greater than value2
;
false
otherwiseequals(double, double, double)
public static boolean greaterThan(double value1, double value2)
value1
is greater than value2
. The
default epsilon EPSILON_DEFAULT_DOUBLE
is used to determine if
the values are equal, in which case it will return false
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is greater than value2
value2
- the value to check if value1
is greater thantrue
if value1
is greater than value2
;
false
otherwiseequals(double, double)
public static boolean lessThanOrEqual(float value1, float value2, float epsilon)
value1
is less than or equal to value2
.
The epsilon
is used to determine if the values are equal, in
which case it will return true
.value1
- the value to check if it is less than or equal to
value2
value2
- the value to check if value1
is less than or
equal toepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is less than or equal to
value2
; false
otherwiseequals(float, float, float)
public static boolean lessThanOrEqual(float value1, float value2)
value1
is less than or equal to value2
.
The default epsilon EPSILON_DEFAULT_FLOAT
is used to determine
if the values are equal, in which case it will return true
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is less than or equal to
value2
value2
- the value to check if value1
is less than or
equal totrue
if value1
is less than or equal to
value2
; false
otherwiseequals(float, float)
public static boolean lessThanOrEqual(double value1, double value2, double epsilon)
value1
is less than or equal to value2
.
The epsilon
is used to determine if the values are equal, in
which case it will return true
.value1
- the value to check if it is less than or equal to
value2
value2
- the value to check if value1
is less than or
equal toepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is less than or equal to
value2
; false
otherwiseequals(double, double, double)
public static boolean lessThanOrEqual(double value1, double value2)
value1
is less than or equal to value2
.
The default epsilon EPSILON_DEFAULT_DOUBLE
is used to
determine if the values are equal, in which case it will return
true
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is less than or equal to
value2
value2
- the value to check if value1
is less than or
equal totrue
if value1
is less than or equal to
value2
; false
otherwiseequals(double, double)
public static boolean greaterThanOrEqual(float value1, float value2, float epsilon)
value1
is greater than or equal to
value2
. The epsilon
is used to determine if the values
are equal, in which case it will return true
.value1
- the value to check if it is greater than or equal to
value2
value2
- the value to check if value1
is greater than or
equal toepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is greater than or equal to
value2
; false
otherwiseequals(float, float, float)
public static boolean greaterThanOrEqual(float value1, float value2)
value1
is greater than or equal to
value2
. The default epsilon EPSILON_DEFAULT_FLOAT
is
used to determine if the values are equal, in which case it will return
true
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is greater than or equal to
value2
value2
- the value to check if value1
is greater than or
equal totrue
if value1
is greater than or equal to
value2
; false
otherwiseequals(float, float)
public static boolean greaterThanOrEqual(double value1, double value2, double epsilon)
value1
is greater than or equal to
value2
. The epsilon
is used to determine if the values
are equal, in which case it will return true
.value1
- the value to check if it is greater than or equal to
value2
value2
- the value to check if value1
is greater than or
equal toepsilon
- the acceptable margin of error between both values where
they will be considered equaltrue
if value1
is greater than or equal to
value2
; false
otherwiseequals(double, double, double)
public static boolean greaterThanOrEqual(double value1, double value2)
value1
is greater than or equal to
value2
. The default epsilon EPSILON_DEFAULT_DOUBLE
is
used to determine if the values are equal, in which case it will return
true
.
Care should be taken when using default epsilons as it may produce unexpected results depending on the values used.
value1
- the value to check if it is greater than or equal to
value2
value2
- the value to check if value1
is greater than or
equal totrue
if value1
is greater than or equal to
value2
; false
otherwiseequals(double, double)
Copyright © 2021 Frostphyr. All rights reserved.