Facebook Page Twitter Page LinkedIn Page
× Java Tutorial Java Advanced Java Resources


The Java Math IEEEremainder() method is used to compute the remainder operation on two arguments as prescribed by the IEEE 754 standard. In special cases it returns the following:

  • 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 x, double y)

Parameters

x Specify the dividend.
y Specify the divisor.

Return Value

Returns the remainder when x is divided by y.

Exception

NA.

Example:

In the below example, IEEEremainder() method is used to calculate the remainder operation on two given arguments.

public class MyClass {
 public static void main(String[] args) {
  System.out.println(Math.IEEEremainder(10.0, 3.0)); 
  System.out.println(Math.IEEEremainder(50.0, 15.0)); 
  System.out.println(Math.IEEEremainder(60.8, 18.1));     
 }
}

The output of the above code will be:

1.0
5.0
6.499999999999993

❮ Java Math Methods