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

longmod(double a, double b)
A modulo function suitable for our purpose.
return (long) (a - b * Math.floor(a / b));
doublemod(double a, double b)
Modulus double operator.
int n = (int) (a / b);
a -= n * b;
if (a < 0.0) {
    a += b;
return (a);
floatMod(double arg1, double arg2)
The FORTRAN mod function
if (arg2 == 0)
    return (float) arg1;
int quo = (int) (arg1 / arg2);
return (float) (arg1 - arg2 * quo);
doublemod(double i, final double n)
mod
i = 0 <= i ? i % n : (n - (-i % n)) % n;
assert 0 <= i && i < n;
return i;
longmod(double left, double right)
mod
validateInput(left, right);
return (long) (left - right * (long) Math.floor(left / right));
doublemod(double m, double n)
Modular arithmetic: m mod n
double result = m % n;
return result < 0 ? result + n : result;
doublemod(double n, double d)
mod
return n - d * Math.floor(n / d);
doublemod(double number, double mod)
mod
if (Math.abs(mod) <= Double.MIN_NORMAL) {
    return 0;
if (number < 0) {
    return mod(number + mod, mod);
} else if (number >= mod) {
    return mod(number - mod, mod);
} else {
...
doublemod(double value, double mod)
mod
if (value < 0 || mod <= 0)
    throw new IllegalArgumentException("value must be >= 0");
int index = (int) (value / mod);
value -= mod * index;
if (value < 0)
    return 0;
else if (value >= mod)
    return 0;
...
doublemod(double x, double m)
Returns the non-negative remainder of x / m.
return ((x % m) + m) % m;