Java Math IEEEremainder() Method

tutorial and example
tutorial and example

The IEEEremainder() method of Math class calculates the remainder as prescribed by the IEEE754 standard. This method simply returns the remainder when f1 (dividend) is divided by f2 (divisor).

Syntax:

public static double IEEEremainder (double f1, double f2)

Parameters:

The parameters ‘f1’ and ‘f2’ represent the dividend and the divisor.

Return Value:

The IEEEremainder () method returns the remainder when first argument is divided by second argument.

Special cases of the IEEEremainder() method are as follows:

  • It returns the result same as the first argument, if the second argument is infinite.
  • It returns NaN , if either argument is NaN or first argument is infinite or second argument is positive or zero.

Example 1:

Output:

Example 2:

Output:

Example 3:

Output:

Example 4:

Output: