Package com.soulfiremc.server.util
Class MathHelper
java.lang.Object
com.soulfiremc.server.util.MathHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
haveSameSign
(double a, double b) static boolean
isOutsideTolerance
(double a, double b, double tolerance) static int
sumCapOverflow
(int a, int b) Sums two integers, returning Integer.MAX_VALUE if the sum overflows.static int
sumCapOverflow
(IntStream stream) Sums the values of the stream, returning Integer.MAX_VALUE if the sum overflows.static float
wrapDegrees
(float value)
-
Method Details
-
haveSameSign
public static boolean haveSameSign(double a, double b) -
isOutsideTolerance
public static boolean isOutsideTolerance(double a, double b, double tolerance) -
sumCapOverflow
public static int sumCapOverflow(int a, int b) Sums two integers, returning Integer.MAX_VALUE if the sum overflows.- Parameters:
a
- The first integer to sumb
- The second integer to sum- Returns:
- The sum of the two integers, or Integer.MAX_VALUE if the sum overflows
-
sumCapOverflow
Sums the values of the stream, returning Integer.MAX_VALUE if the sum overflows.- Parameters:
stream
- The stream to sum- Returns:
- The sum of the stream, or Integer.MAX_VALUE if the sum overflows
-
wrapDegrees
public static float wrapDegrees(float value)
-