Skip to content

Commit

Permalink
Add method to compare two double values
Browse files Browse the repository at this point in the history
  • Loading branch information
AntumDeluge committed May 16, 2024
1 parent d9e7a27 commit 22c0964
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/games/stendhal/common/math/Algebra.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ public static boolean isEqual_Scalf(float a, float b)
return Math.abs(a - b) <= EPSILON;
}

/**
* Checks if two double values are approximately equal within a small tolerance.
*
* @param a
* First value to compare.
* @param b
* Second value to compare.
* @return
* {@code true} if the difference between {@code a} and {@code b} is less than or equal to the
* level of tolerance.
*/
public static boolean isEqual_Scald(double a, double b) {
return Math.abs(a - b) <= EPSILON;
}

public static boolean isEqual_Vecf(float[] a, float[] b)
{
assert a.length == b.length;
Expand Down

0 comments on commit 22c0964

Please sign in to comment.