- Java.lang Package classes
- Java.lang - Home
- Java.lang - Boolean
- Java.lang - Byte
- Java.lang - Character
- Java.lang - Character.Subset
- Java.lang - Character.UnicodeBlock
- Java.lang - Class
- Java.lang - ClassLoader
- Java.lang - Compiler
- Java.lang - Double
- Java.lang - Enum
- Java.lang - Float
- Java.lang - InheritableThreadLocal
- Java.lang - Integer
- Java.lang - Long
- Java.lang - Math
- Java.lang - Number
- Java.lang - Object
- Java.lang - Package
- Java.lang - Process
- Java.lang - ProcessBuilder
- Java.lang - Runtime
- Java.lang - RuntimePermission
- Java.lang - SecurityManager
- Java.lang - Short
- Java.lang - StackTraceElement
- Java.lang - StrictMath
- Java.lang - String
- Java.lang - StringBuffer
- Java.lang - StringBuilder
- Java.lang - System
- Java.lang - Thread
- Java.lang - ThreadGroup
- Java.lang - ThreadLocal
- Java.lang - Throwable
- Java.lang - Void
- Java.lang Package extras
- Java.lang - Interfaces
- Java.lang - Errors
- Java.lang - Exceptions
- Java.lang Package Useful Resources
- Java.lang - Useful Resources
- Java.lang - Discussion
Java - Math IEEEremainder(double x, double y) method
Description
The Java Math IEEEremainder(double f1, double f2) returns Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to f1 - f2 x n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument. Special cases −
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.
Declaration
Following is the declaration for java.lang.Math.IEEEremainder() method
public static double IEEEremainder(double f1, double f2)
Parameters
f1 − the dividend.
f2 − the divisor.
Return Value
This method returns the remainder when f1 is divided by f2.
Exception
NA
Example 1
The following example shows the usage of Math IEEEremainder() method.
package com.tutorialspoint; public class MathDemo { public static void main(String[] args) { // get two double numbers double x = 60984.1; double y = -497.99; // call IEEEremainder and print the result System.out.println("Math.IEEEremainder(" + x + "," + y + ")=" + Math.IEEEremainder(x, y)); } }
Output
Let us compile and run the above program, this will produce the following result −
Math.IEEEremainder(60984.1,-497.99)=229.31999999999744
Example 2
The following example shows the usage of Math IEEEremainder() method of zero value.
package com.tutorialspoint; public class MathDemo { public static void main(String[] args) { // get two double numbers double x = 0.0; double y = -0.0; // call IEEEremainder and print the result System.out.println("Math.IEEEremainder(" + x + "," + y + ")=" + Math.IEEEremainder(x, y)); } }
Output
Let us compile and run the above program, this will produce the following result −
Math.IEEEremainder(0.0,-0.0)=NaN
Example 3
The following example shows the usage of Math IEEEremainder() method of a 1 value.
package com.tutorialspoint; public class MathDemo { public static void main(String[] args) { // get two double numbers double x = 1.0; double y = -1.0; // call hypot and print the result System.out.println("Math.IEEEremainder(" + x + "," + y + ")=" + Math.IEEEremainder(x, y)); } }
Output
Let us compile and run the above program, this will produce the following result −
Math.IEEEremainder(1.0,-1.0)=0.0