Java.lang Package Classes

Java Math - IEEEremainder() Method



The java.lang.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 example below, IEEEremainder() method is used to calculate the remainder operation on two given arguments.

import java.lang.*;

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.lang - Math