Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to
f1 - f2 x n,
, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2
, and if two mathematical integers are equally close to f1/f2
, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument.

package com.logicbig.example.math;
public class IEEEremainderExample {
public static void main(String... args) {
findReminder(24.3, 5.1);
findReminder(-31, 5.0);
findReminder(Double.MIN_VALUE, 3.0);
findReminder(Double.POSITIVE_INFINITY, 3.0);
}
private static void findReminder(double x, double y) {
double getReminder_value = Math.IEEEremainder(x, y);
System.out.printf(" Math.IEEEremainder(%s,%s) = %s%n", x, y, getReminder_value);
}
}
Output
Math.IEEEremainder(24.3,5.1) = -1.1999999999999975
Math.IEEEremainder(-31.0,5.0) = -1.0
Math.IEEEremainder(4.9E-324,3.0) = 4.9E-324
Math.IEEEremainder(Infinity,3.0) = NaN