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
- MathF.Sin() Method in C# with Examples
- MathF.Max() Method in C# with Examples
- MathF.Min() Method in C# with Examples
- MathF.Log() Method in C# with Examples
- MathF.Pow() Method in C# with Examples
- MathF.Cos() Method in C# with Examples
- MathF.Exp() Method in C# with Examples
- MathF.Tan() Method in C# with Examples
- MathF.Abs() Method in C# with Examples
- Int64.CompareTo Method in C# with Examples
- C# | Char.GetTypeCode() Method with Examples
- C# | Char.GetHashCode() Method with Examples
- Double.CompareTo Method in C# with Examples
- MathF.Atan() Method in C# with Examples
- C# | Object.GetHashCode() Method 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 email@example.com. 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.