Saturday, November 22, 2025
HomeLanguagesJavaStrictMath IEEEremainder() Method in Java

StrictMath IEEEremainder() Method in Java

The Java.lang.StrictMath.IEEEremainder() is an inbuilt method of StrictMath class which is used to perform the remainder operation on given two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to num1 - num2 * rem   , where rem is the mathematical integer closest to exact mathematical value of the quotient num1 / num2   , and when two mathematical integers are equally close to num1 / num2   , and n is an even integer. It gives rise to two special results: 

  • Its sign is same as the sign of the first argument when the remainder is zero.
  • It returns NaN when either argument is NaN, or num1 is infinite, or num2 is positive or negative zero.
  • The result is same as the num1 when num1 is finite and the num2 is infinite.

Syntax: 

public static double IEEEremainder(double num1, double num2)

Parameters: The method accepts two parameters : 

  • num1: This is of double type which is the dividend.
  • num2 This is also of double type which is the divisor.

Return Value: The method returns the remainder when num1 is divided by num2.
Examples : 

Input: 
num1 = 100.61d
num2 = 5.32d

Output: -0.47000000000000597

Below programs illustrate the Java.lang.StrictMath.IEEEremainder() method: 
Program 1: 

java




// Java program to illustrate the
// Java.lang.StrictMath.IEEEremainder()
import java.lang.*;
 
public class Geeks {
 
    public static void main(String[] args)
    {
 
        double num1 = 5651.51d, num2 = 61.79d;
 
        // It  returns the remainder value
        double remain_val = StrictMath.IEEEremainder(num1, num2);
        System.out.println("Remainder value of "+num1+" & "+num2
                                            +" = " + remain_val);
    }
}


Output: 

Remainder value of 5651.51 & 61.79 = 28.620000000000296

 

Program 2: 

java




// Java program to illustrate the
// Java.lang.StrictMath.IEEEremainder()
import java.lang.*;
 
public class Geeks {
 
    public static void main(String[] args)
    {
        /* Here  num1 is finite and num2 is infinite so
     the result is the same as the num1 */
        double num1 = 70.55d, num2 = (1.0) / (0.0);
 
        double remain_val = StrictMath.IEEEremainder(num1, num2);
        System.out.println("Remainder value of "+num1+" & "+num2
                                            +" = " + remain_val);
    }
}


Output: 

Remainder value is = 70.55

 

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32407 POSTS0 COMMENTS
Milvus
97 POSTS0 COMMENTS
Nango Kala
6785 POSTS0 COMMENTS
Nicole Veronica
11932 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12000 POSTS0 COMMENTS
Shaida Kate Naidoo
6907 POSTS0 COMMENTS
Ted Musemwa
7168 POSTS0 COMMENTS
Thapelo Manthata
6864 POSTS0 COMMENTS
Umr Jansen
6852 POSTS0 COMMENTS