![]() |
VOOZH | about |
The IEEEremainder() method in Java is a part of the java.lang.Math class. This method calculates the remainder operation on two arguments based on the IEEE 754 standard, which is different from the regular modulus "%" operator.
The method calculates the remainder using the below formula:
remainder = dividend - (divisor × n)
The remainder value is mathematically equal to dividend - (divisor × n), where n is the mathematical integer closest to the exact mathematical value of the quotient dividend / divisor, and if two mathematical integers are equally close to dividend / divisor, then n is the integer that is even.
public static double Math.IEEEremainder(double dividend, double divisor)
For Special Cases:
Example 1: In this example, we will see the working of IEEEremainder() method.
Result: 0.5399999999999974
Example 2: In this example, we will see how IEEEremainder() method handles negative values and zero.
Result: -0.0
Example 3: In this example, we will see how IEEEremainder() method handles edge cases.
Infinity / 0 = NaN Finite / Infinity = -2.34