/** * Returns the remainder of the division of the specified two arguments. * * @param x the dividend. * @param y the divisor. * @return <code>x - round(x / y) * y</code> */ public static double rem(double x, double y) { double tmp = x / y; if (MathLib.abs(tmp) <= Long.MAX_VALUE) return x - MathLib.round(tmp) * y; else return NaN; }