public final class MathUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double |
SAFE_MIN
Safe minimum, such that 1 / SAFE_MIN does not overflow.
|
Modifier and Type | Method and Description |
---|---|
static double |
dCos(double degrees)
Returns the cosine of an angle given in degrees.
|
static int |
divisorMod(int a,
int n)
Modulus, divisor-style.
|
static double |
dSin(double degrees)
Returns the sine of an angle given in degrees.
|
static double |
roundHalfUp(double value)
Returns the rounded double of the given value, rounding to the
nearest integer value away from zero on ties.
|
public static final double SAFE_MIN
In IEEE 754 arithmetic, this is also the smallest normalized number 2-1022. The value of this constant is from Apache Commons Math 2.2.
public static int divisorMod(int a, int n)
a
- an
- npublic static double dCos(double degrees)
Math.cos(Math.toRadians(degrees))
because it provides a
more accurate result for angles divisible by 90 degrees.degrees
- the anglepublic static double dSin(double degrees)
Math.sin(Math.toRadians(degrees))
because it provides a more
accurate result for angles divisible by 90 degrees.degrees
- the anglepublic static double roundHalfUp(double value)
This behavior is the same as RoundingMode.HALF_UP
.
value
- the value