Package de.bsommerfeld.pathetic.api.util
Class NumberUtils
java.lang.Object
de.bsommerfeld.pathetic.api.util.NumberUtils
Utility class for common number operations.
-
Method Summary
Modifier and TypeMethodDescriptionstatic doubleinterpolate(double a, double b, double progress) Interpolates between two values based on the given progress.static doublesqrt(double input) Deprecated.static doublesquare(double value) Squares the given value.
-
Method Details
-
interpolate
public static double interpolate(double a, double b, double progress) Interpolates between two values based on the given progress.- Parameters:
a- the start valueb- the end valueprogress- the interpolation progress (0.0 to 1.0)- Returns:
- the interpolated value
-
square
public static double square(double value) Squares the given value.- Parameters:
value- the value to be squared- Returns:
- the squared value
-
sqrt
Deprecated.CallMath.sqrt(double)directly. This now simply delegates to it; the former bit-hack approximation was less precise than the JDK intrinsic (and wrong at0) without being faster.Computes the square root of the given value.- Parameters:
input- the value to compute the square root of- Returns:
- the square root of
input
-
Math.sqrt(double)directly.