StrictMath.IEEEremainder() in Java

StrictMath.IEEEremainder(): This method is available in java.lang.StrictMath class of Java.

Syntax:

double java.lang.StrictMath.IEEEremainder(double f1, double f2)

This method takes two arguments of type double as its parameters. This method computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to f1 - f2 × n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2.

Parameters: Two parameters are required for this method.

f1: the dividend.

f2: the divisor.

Returns: the remainder when f1 is divided by f2.

Exceptions: NA

Approach

Java

public class StrictMathIEEEremainder {
    public static void main(String[] args) {

        double f1 = 1991.881, f2 = 119.78;
        System.out.println(StrictMath.IEEEremainder(f1, f2));
    }
}

Output:

-44.378999999999934


No comments:

Post a Comment