The **java.lang.Math.IEEEremainder()** method 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.

**Note :**

- If the remainder is zero, its sign is the same as the sign of the first argument.
- If either argument is NaN, or the first argument is infinite, or the second argument is positive zero or negative zero, then the result is NaN.
- If the first argument is finite and the second argument is infinite, then the result is the same as the first argument.

**Syntax**:

public static double IEEEremainder(double dividend, double divisor)Parameter: dividend : the dividend. divisor : the divisor.Return: This method returns the remainder when dividend is divided by divisor.

**Example 1**: To show working of **java.lang.Math.IEEEremainder()** method.

`// Java program to demonstrate working ` `// of java.lang.Math.IEEEremainder() method ` `import` `java.lang.Math; ` ` ` `class` `Gfg { ` ` ` ` ` `// driver code ` ` ` `public` `static` `void` `main(String args[]) ` ` ` `{ ` ` ` `double` `did1 = ` `31.34` `; ` ` ` `double` `dis1 = ` `2.2` `; ` ` ` `System.out.println(Math.IEEEremainder(did1, dis1)); ` ` ` ` ` `double` `did2 = -` `21.0` `; ` ` ` `double` `dis2 = ` `7.0` `; ` ` ` ` ` `// Sign of did2 is negative, Output is negative zero ` ` ` `System.out.println(Math.IEEEremainder(did2, dis2)); ` ` ` ` ` `double` `did3 = ` `1.0` `/ ` `0` `; ` ` ` `double` `dis3 = ` `0.0` `; ` ` ` ` ` `// First argument is infinity and Second argument is zero ` ` ` `// Output NaN ` ` ` `System.out.println(Math.IEEEremainder(did3, dis3)); ` ` ` ` ` `double` `did4 = -` `2.34` `; ` ` ` `double` `dis4 = ` `1.0` `/ ` `0` `; ` ` ` ` ` `// First argument finite and Second argument is infinity ` ` ` `// Output first argument ` ` ` `System.out.println(Math.IEEEremainder(did4, dis4)); ` ` ` `} ` `} ` |

*chevron_right*

*filter_none*

Output:

0.5399999999999974 -0.0 NaN -2.34

Attention reader! Don’t stop learning now. Get hold of all the important Java and Collections concepts with the **Fundamentals of Java and Java Collections Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- StrictMath IEEEremainder() Method in Java
- Java Math random() method with Examples
- Java Math min() method with Examples
- Java Math max() method with Examples
- Java Math abs() method with Examples
- Java Math acos() method with Examples
- Java Math sin() method with Examples
- Java Math sinh() method with Examples
- Java Math cosh() method with Examples
- Java Math tanh() method with Examples
- Java Math cos() method with Examples
- Java Math tan() method with Examples
- Java Math copySign() method with Examples
- Java Math nextDown() method with Examples
- Java Math nextUp() method with Examples
- Java Math ulp() method with Examples
- Math fma() method in Java with Examples
- Math multiplyHigh() method in Java with Examples
- Math multiplyFull() method in Java with Examples
- Java.math.BigInteger.modInverse() method in Java

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.