List of utility methods to do Double Number mod
double | modPI2(double angle) mod PI while (angle < -Math.PI) angle += 2.0 * Math.PI; while (angle > Math.PI) angle -= 2.0 * Math.PI; return angle; |
double | Modulo(double x, double y) Modulo function return y * Frac(x / y);
|
int | modulo10(double d, boolean round) Returns the integer result of (d mod 10). long l = round ? Math.round(d) : (long) Math.floor(d); int i = (int) (l % 10); return i; |
double | moduloAngle(double angle) Return the angle between -PI and PI that corresponds to the given angle. while (angle > Math.PI) { angle -= 2 * Math.PI; while (angle < -Math.PI) { angle += 2 * Math.PI; return angle; |
double | moduloTwoPI(double x) clamp to range 0..2PI while (x < 0) x += PI2; while (x > PI2) x -= PI2; return x; |
long | modValue(double v, int precision) mod Value return precision <= 0 ? (long) v : (long) (v * Math.pow(10, precision)); |