Class MathHelper
java.lang.Object
com.soulfiremc.server.util.MathHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanhaveSameSign(double a, double b) static booleanisOutsideTolerance(double a, double b, double tolerance) static intsumCapOverflow(int a, int b) Sums two integers, returning Integer.MAX_VALUE if the sum overflows.static intsumCapOverflow(IntStream stream) Sums the values of the stream, returning Integer.MAX_VALUE if the sum overflows.static floatwrapDegrees(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)
-