| Modifier and Type | Field and Description |
|---|---|
| public static final double | EPSILON
Largest double-precision floating-point number such that
|
| private static final long | EXPONENT_OFFSET
Exponent offset in IEEE754 representation. |
| private static final long | NEGATIVE_ZERO_DOUBLE_BITS
Negative zero bits. |
| private static final int | NEGATIVE_ZERO_FLOAT_BITS
Negative zero bits. |
| private static final double | POSITIVE_ZERO
Positive zero. |
| private static final long | POSITIVE_ZERO_DOUBLE_BITS
Positive zero bits. |
| private static final int | POSITIVE_ZERO_FLOAT_BITS
Positive zero bits. |
| public static final double | SAFE_MIN
Safe minimum, such that |
| private static final long | SGN_MASK
Offset to order signed double numbers lexicographically. |
| private static final int | SGN_MASK_FLOAT
Offset to order signed double numbers lexicographically. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static int | Returns:
the first number x, double the second number y, double the amount of error to allow when checking for equality eps)Compares two numbers given some amount of allowed error. |
| public static int | Returns:
first value x, final double second value y, final int (maxUlps - 1) is the number of floating point
values between x and y.Compares two numbers given some amount of allowed error. |
| public static boolean | Returns: true if the values are equal.first value x, float second value y)Returns true iff they are equal as defined by
|
| public static boolean | Returns: true if the values are equal or within range of each other.first value x, float second value y, float the amount of absolute error to allow. eps)Returns true if the arguments are equal or within the range of allowed error (inclusive). |
| public static boolean | Returns: true if there are fewer than maxUlps floating
point values between x and y.first value x, final float second value y, final int (maxUlps - 1) is the number of floating point
values between x and y.Returns true if the arguments are equal or within the range of allowed error (inclusive). |
| public static boolean | Returns: true if the values are equal.first value x, double second value y)Returns true iff they are equal as defined by
|
| public static boolean | Returns: true if the values are two adjacent floating point
numbers or they are within range of each other.First value. x, double Second value. y, double Amount of allowed absolute error. eps)Returns |
| public static boolean | Returns: true if there are fewer than maxUlps floating
point values between x and y.first value x, final double second value y, final int (maxUlps - 1) is the number of floating point
values between x and y.Returns true if the arguments are equal or within the range of allowed error (inclusive). |
| public static boolean | Returns: true if the values are equal or both are NaN.first value x, float second value y)Returns true if both arguments are NaN or they are
equal as defined by |
| public static boolean | Returns: true if the values are equal or within range of each other,
or both are NaN.first value x, float second value y, float the amount of absolute error to allow. eps)Returns true if the arguments are both NaN, are equal, or are within the range of allowed error (inclusive). |
| public static boolean | Returns: true if both arguments are NaN or if there are less than
maxUlps floating point values between x and y.first value x, float second value y, int (maxUlps - 1) is the number of floating point
values between x and y.Returns true if the arguments are both NaN or if they are equal as defined
by |
| public static boolean | Returns: true if the values are equal or both are NaN.first value x, double second value y)Returns true if the arguments are both NaN or they are
equal as defined by |
| public static boolean | Returns: true if the values are equal or within range of each other,
or both are NaN.first value x, double second value y, double the amount of absolute error to allow. eps)Returns true if the arguments are both NaN, are equal or are within the range of allowed error (inclusive). |
| public static boolean | Returns: true if both arguments are NaN or if there are less than
maxUlps floating point values between x and y.first value x, double second value y, int (maxUlps - 1) is the number of floating point
values between x and y.Returns true if both arguments are NaN or if they are equal as defined
by |
| public static boolean | Returns: true if the values are two adjacent floating point
numbers or they are within range of each other.First value. x, double Second value. y, double Amount of allowed relative error. eps)Returns |
| public static double | Returns: a numberdelta so that x + delta and x
differ by a representable floating number.Value. x, double Offset value. originalDelta)Computes a number
|
| public static double | Returns: the rounded value.Value to round. x, int Number of digits to the right of the decimal point. scale)Rounds the given value to the specified number of decimal places. |
| public static double | Returns: the rounded value.Value to round. x, int Number of digits to the right of the decimal point. scale, int Rounding method as defined in roundingMethod)BigDecimal.Rounds the given value to the specified number of decimal places. |
| public static float | Returns: the rounded value.Value to round. x, int Number of digits to the right of the decimal point. scale)Rounds the given value to the specified number of decimal places. |
| public static float | Returns: the rounded value.Value to round. x, int Number of digits to the right of the decimal point. scale, int Rounding method as defined in roundingMethod)BigDecimal.Rounds the given value to the specified number of decimal places. |
| private static double | Returns: the rounded value.Value to round. unscaled, double Sign of the original, scaled value. sign, int Rounding method, as defined in roundingMethod)BigDecimal.Rounds the given non-negative value to the "nearest" integer. |
| EPSILON | back to summary |
|---|---|
| public static final double EPSILON
Largest double-precision floating-point number such that
In IEEE 754 arithmetic, this is 2-53.
| |
| EXPONENT_OFFSET | back to summary |
|---|---|
| private static final long EXPONENT_OFFSET Exponent offset in IEEE754 representation. | |
| NEGATIVE_ZERO_DOUBLE_BITS | back to summary |
|---|---|
| private static final long NEGATIVE_ZERO_DOUBLE_BITS Negative zero bits. | |
| NEGATIVE_ZERO_FLOAT_BITS | back to summary |
|---|---|
| private static final int NEGATIVE_ZERO_FLOAT_BITS Negative zero bits. | |
| POSITIVE_ZERO | back to summary |
|---|---|
| private static final double POSITIVE_ZERO Positive zero. | |
| POSITIVE_ZERO_DOUBLE_BITS | back to summary |
|---|---|
| private static final long POSITIVE_ZERO_DOUBLE_BITS Positive zero bits. | |
| POSITIVE_ZERO_FLOAT_BITS | back to summary |
|---|---|
| private static final int POSITIVE_ZERO_FLOAT_BITS Positive zero bits. | |
| SAFE_MIN | back to summary |
|---|---|
| public static final double SAFE_MIN Safe minimum, such that | |
| SGN_MASK | back to summary |
|---|---|
| private static final long SGN_MASK Offset to order signed double numbers lexicographically. | |
| SGN_MASK_FLOAT | back to summary |
|---|---|
| private static final int SGN_MASK_FLOAT Offset to order signed double numbers lexicographically. | |
| Precision | back to summary |
|---|---|
| private Precision() Private constructor. | |
| compareTo | back to summary |
|---|---|
| public static int compareTo(double x, double y, double eps) Compares two numbers given some amount of allowed error.
| |
| compareTo | back to summary |
|---|---|
| public static int compareTo(final double x, final double y, final int maxUlps) Compares two numbers given some amount of allowed error.
Two float numbers are considered equal if there are
| |
| equals | back to summary |
|---|---|
| public static boolean equals(float x, float y) Returns true iff they are equal as defined by
| |
| equals | back to summary |
|---|---|
| public static boolean equals(float x, float y, float eps) Returns true if the arguments are equal or within the range of allowed
error (inclusive). Returns
| |
| equals | back to summary |
|---|---|
| public static boolean equals(final float x, final float y, final int maxUlps) Returns true if the arguments are equal or within the range of allowed
error (inclusive).
Two float numbers are considered equal if there are
| |
| equals | back to summary |
|---|---|
| public static boolean equals(double x, double y) Returns true iff they are equal as defined by
| |
| equals | back to summary |
|---|---|
| public static boolean equals(double x, double y, double eps) Returns
| |
| equals | back to summary |
|---|---|
| public static boolean equals(final double x, final double y, final int maxUlps) Returns true if the arguments are equal or within the range of allowed error (inclusive).
Two float numbers are considered equal if there are
Adapted from
Bruce Dawson. Returns
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(float x, float y) Returns true if both arguments are NaN or they are
equal as defined by
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(float x, float y, float eps) Returns true if the arguments are both NaN, are equal, or are within the range of allowed error (inclusive).
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(float x, float y, int maxUlps) Returns true if the arguments are both NaN or if they are equal as defined
by
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(double x, double y) Returns true if the arguments are both NaN or they are
equal as defined by
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(double x, double y, double eps) Returns true if the arguments are both NaN, are equal or are within the range of allowed error (inclusive).
| |
| equalsIncludingNaN | back to summary |
|---|---|
| public static boolean equalsIncludingNaN(double x, double y, int maxUlps) Returns true if both arguments are NaN or if they are equal as defined
by
| |
| equalsWithRelativeTolerance | back to summary |
|---|---|
| public static boolean equalsWithRelativeTolerance(double x, double y, double eps) Returns
| |
| representableDelta | back to summary |
|---|---|
| public static double representableDelta(double x, double originalDelta) Computes a number
is exactly machine-representable.
This is useful when computing numerical derivatives, in order to reduce
roundoff errors.
| |
| round | back to summary |
|---|---|
| public static double round(double x, int scale) Rounds the given value to the specified number of decimal places.
The value is rounded using the
| |
| round | back to summary |
|---|---|
| public static double round(double x, int scale, int roundingMethod) Rounds the given value to the specified number of decimal places.
The value is rounded using the given method which is any method defined
in
| |
| round | back to summary |
|---|---|
| public static float round(float x, int scale) Rounds the given value to the specified number of decimal places.
The value is rounded using the
| |
| round | back to summary |
|---|---|
| public static float round(float x, int scale, int roundingMethod) throws MathArithmeticException, MathIllegalArgumentException Rounds the given value to the specified number of decimal places.
The value is rounded using the given method which is any method defined
in
| |
| roundUnscaled | back to summary |
|---|---|
| private static double roundUnscaled(double unscaled, double sign, int roundingMethod) throws MathArithmeticException, MathIllegalArgumentException Rounds the given non-negative value to the "nearest" integer. Nearest is
determined by the rounding method specified. Rounding methods are defined
in
| |