Java Utililty Methods Double Number mod

List of utility methods to do Double Number mod

Description

The list of methods to do Double Number mod are organized into topic(s).

Method

doublemodPI2(double angle)
mod PI
while (angle < -Math.PI)
    angle += 2.0 * Math.PI;
while (angle > Math.PI)
    angle -= 2.0 * Math.PI;
return angle;
doubleModulo(double x, double y)
Modulo function
return y * Frac(x / y);
intmodulo10(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;
doublemoduloAngle(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;
doublemoduloTwoPI(double x)
clamp to range 0..2PI
while (x < 0)
    x += PI2;
while (x > PI2)
    x -= PI2;
return x;
longmodValue(double v, int precision)
mod Value
return precision <= 0 ? (long) v : (long) (v * Math.pow(10, precision));