In C#, IEEERemainder(Single) is a MathF class method which is used to return the remainder resulting from the division of a specified number by another specified number.
Syntax: public static float IEEERemainder (float x, float y);
x: It is the dividend of type System.Single.
y: It is the divisor of type System.Single.
Return Type: This method returns a number equal to x – (y Q), where Q is the quotient of x / y rounded to the nearest integer of type System.Single.
- If x / y falls halfway between two integers, the even integer is returned.
- If x – (y Q) is zero, the value Positive Zero is returned if x is positive, or Negative Zero if y is negative.
- If y = 0, NaN is returned.
Difference Between IEEERemainder and Remainder Operator: Both are used to returns the remainder after division but the formulas they use are different. The formula for the IEEERemainder method is:
IEEERemainder = dividend - (divisor * MathF.Round(dividend / divisor))
And the formula for the remainder operator is:
Remainder = (MathF.Abs(dividend) - (MathF.Abs(divisor) * (MathF.Floor(MathF.Abs(dividend) / MathF.Abs(divisor))))) * MathF.Sign(dividend)
IEEERemainder Remainder Operator 0 / 1 = 0 0 -4 / 8 = -4 -4 1 / 0 = NaN NaN -1 / 0 = NaN NaN 175 / 6 = 1 1 784.52 / 124 = 40.52002 40.52002 92.267 / 3.259 = 1.014997 1.014997
- Array.GetValue() Method in C# with Examples | Set - 1
- MathF.Sin() Method in C# with Examples
- Double.CompareTo Method in C# with Examples
- UInt16.GetHashCode Method in C# with Examples
- Int64.CompareTo Method in C# with Examples
- MathF.Truncate() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- C# | Queue<T>.TrimExcess Method with Examples
- C# | Stack<T>.TrimExcess Method with Examples
- Array.BinarySearch(Array, Object) Method with examples in C#
- C# | Char.GetHashCode() Method with Examples
- C# | Char.GetTypeCode() Method with Examples
- C# | Char.GetUnicodeCategory(String, Int32) Method with Examples
- C# | Object.GetHashCode() Method with Examples
- C# | Object.GetTypeCode() Method with Examples
- Graphics.Clear() Method in C# with Examples
- Type.GetConstructors() Method in C# with Examples
- List.FindIndex() Method in C# with Examples
- Double.Equals() Method in C# with Examples
- Decimal.GetTypeCode Method in C# with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.