summaryrefslogtreecommitdiff
path: root/src/main/java/sevenUnits/utils/DecimalComparison.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/sevenUnits/utils/DecimalComparison.java')
-rw-r--r--src/main/java/sevenUnits/utils/DecimalComparison.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/main/java/sevenUnits/utils/DecimalComparison.java b/src/main/java/sevenUnits/utils/DecimalComparison.java
index c7564c4..1366fd3 100644
--- a/src/main/java/sevenUnits/utils/DecimalComparison.java
+++ b/src/main/java/sevenUnits/utils/DecimalComparison.java
@@ -20,7 +20,7 @@ import java.math.BigDecimal;
/**
* A class that contains methods to compare float and double values.
- *
+ *
* @author Adrien Hopkins
* @since 2019-03-18
* @since v0.2.0
@@ -29,7 +29,7 @@ public final class DecimalComparison {
/**
* The value used for double comparison. If two double values are within this
* value multiplied by the larger value, they are considered equal.
- *
+ *
* @since 2019-03-18
* @since v0.2.0
*/
@@ -38,7 +38,7 @@ public final class DecimalComparison {
/**
* The value used for float comparison. If two float values are within this
* value multiplied by the larger value, they are considered equal.
- *
+ *
* @since 2019-03-18
* @since v0.2.0
*/
@@ -63,20 +63,20 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code double} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @return whether they are equal
* @since 2019-03-18
* @since v0.2.0
*/
- public static final boolean equals(final double a, final double b) {
+ public static boolean equals(final double a, final double b) {
return DecimalComparison.equals(a, b, DOUBLE_EPSILON);
}
/**
* Tests for double equality using a custom epsilon value.
- *
+ *
* <p>
* <strong>WARNING: </strong>this method is not technically transitive. If a
* and b are off by slightly less than {@code epsilon * max(abs(a), abs(b))},
@@ -93,7 +93,7 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code double} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @param epsilon allowed difference
@@ -101,14 +101,14 @@ public final class DecimalComparison {
* @since 2019-03-18
* @since v0.2.0
*/
- public static final boolean equals(final double a, final double b,
+ public static boolean equals(final double a, final double b,
final double epsilon) {
return Math.abs(a - b) <= epsilon * Math.max(Math.abs(a), Math.abs(b));
}
/**
* Tests for equality of float values using {@link #FLOAT_EPSILON}.
- *
+ *
* <p>
* <strong>WARNING: </strong>this method is not technically transitive. If a
* and b are off by slightly less than {@code epsilon * max(abs(a), abs(b))},
@@ -125,20 +125,20 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code float} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @return whether they are equal
* @since 2019-03-18
* @since v0.2.0
*/
- public static final boolean equals(final float a, final float b) {
+ public static boolean equals(final float a, final float b) {
return DecimalComparison.equals(a, b, FLOAT_EPSILON);
}
/**
* Tests for float equality using a custom epsilon value.
- *
+ *
* <p>
* <strong>WARNING: </strong>this method is not technically transitive. If a
* and b are off by slightly less than {@code epsilon * max(abs(a), abs(b))},
@@ -155,7 +155,7 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code float} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @param epsilon allowed difference
@@ -163,7 +163,7 @@ public final class DecimalComparison {
* @since 2019-03-18
* @since v0.2.0
*/
- public static final boolean equals(final float a, final float b,
+ public static boolean equals(final float a, final float b,
final float epsilon) {
return Math.abs(a - b) <= epsilon * Math.max(Math.abs(a), Math.abs(b));
}
@@ -188,14 +188,14 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code double} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @return whether they are equal
* @since 2020-09-07
* @since v0.3.0
*/
- public static final boolean equals(final UncertainDouble a,
+ public static boolean equals(final UncertainDouble a,
final UncertainDouble b) {
return DecimalComparison.equals(a.value(), b.value())
&& DecimalComparison.equals(a.uncertainty(), b.uncertainty());
@@ -203,7 +203,7 @@ public final class DecimalComparison {
/**
* Tests for {@code UncertainDouble} equality using a custom epsilon value.
- *
+ *
* <p>
* <strong>WARNING: </strong>this method is not technically transitive. If a
* and b are off by slightly less than {@code epsilon * max(abs(a), abs(b))},
@@ -220,7 +220,7 @@ public final class DecimalComparison {
* <li>Use {@link BigDecimal} instead of {@code double} (this will make a
* violation of transitivity 100% impossible)
* </ol>
- *
+ *
* @param a first value to test
* @param b second value to test
* @param epsilon allowed difference
@@ -228,7 +228,7 @@ public final class DecimalComparison {
* @since 2019-03-18
* @since v0.2.0
*/
- public static final boolean equals(final UncertainDouble a,
+ public static boolean equals(final UncertainDouble a,
final UncertainDouble b, final double epsilon) {
return DecimalComparison.equals(a.value(), b.value(), epsilon)
&& DecimalComparison.equals(a.uncertainty(), b.uncertainty(),