Mono Class Library: System.Math Overview | MembersSystem.Math.IEEERemainder Method |
Returns the remainder resulting from the division of one specified double by another specified double. [Edit]
|
A double whose value is as follows:
[Edit]
Value Description x - (y Q), Q is the quotient of x/y rounded to the nearest integer (if x/y is exactly halfway between two integers, the even integer is returned). +0 Q is the quotient of x/y rounded to the nearest integer (if x/y is exactly halfway between two integers, the even integer is returned), x - (y Q) is zero, and x is positive. -0 Q is the quotient of x/y rounded to the nearest integer (if x/y is exactly halfway between two integers, the even integer is returned), x - (y Q) is zero, and x is negative. double.NaN y = 0.
This operation complies with the remainder operation defined in Section 5.1 of ANSI/IEEE Std 754-1985; IEEE Standard for Binary Floating-Point Arithmetic; Institute of Electrical and Electronics Engineers, Inc; 1985.
Note: For more information regarding the use of +0 and -0, see Section 3.1 of ANSI/IEEE Std 754-1985; IEEE Standard for Binary Floating-Point Arithmetic; Institute of Electrical and Electronics Engineers, Inc; 1985.[Edit]
The following example demonstrates using the Math.IEEERemainder(double, double) method.
C# Example using System; public class MathIEEERemainderExample { public static void Main() { Double d1 = Math.IEEERemainder(3.54,0); Double d2 = Math.IEEERemainder(9.99,-3.33); Double d3 = Math.IEEERemainder(-9.99,3.33); Double d4 = Math.IEEERemainder(9.5,1.5); Console.WriteLine("Math.IEEERemainder(3.54,0) returns {0}", d1); Console.WriteLine("Math.IEEERemainder(9.99,-3.33) returns {0}", d2); Console.WriteLine("Math.IEEERemainder(-9.99,3.33) returns {0}", d3); Console.WriteLine("Math.IEEERemainder(9.5,1.5) returns {0}", d4); } }The output is
Math.IEEERemainder(3.54,0) returns NaN
Math.IEEERemainder(9.99,-3.33) returns 0
Math.IEEERemainder(-9.99,3.33) returns 0
Math.IEEERemainder(9.5,1.5) returns 0.5
Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0