What is Math.IEEERemainder() in C#?
C# has a built-in Math class that provides useful mathematical functions and operations. The class has the IEEERemainder() function, which is used to compute the remainder resulting from the division of two specified numbers.
Syntax
public static double IEEERemainder (double param1, double param2);
Parameters
param1: This is adoublenumber that specifies the dividend.param2: This is adoublenumber that specifies the divisor.
Return value
remainder = dividend - divisor*Quotient
where Quotient = Math.Round(dividend/divisor)
- Double: This returns a
Doublenumber specifying theremainder. - 0: If
remainder= 0, this returns:+0ifdividend> 0-0ifdividend< 0
- NaN: This returns
NaNifdivisor= 0.
Quotientis rounded to the nearest integer. It returns an even integer if halfway between two integers.
Example
using System;class Educative{static void Main(){double result = Math.IEEERemainder(3, 2);System.Console.WriteLine("IEEERemainder(3, 2) = "+ result);double result1 = Math.IEEERemainder(3, 3);System.Console.WriteLine("IEEERemainder(3, 3) = "+ result1);double result2 = Math.IEEERemainder(3, 0);System.Console.WriteLine("IEEERemainder(3, 0) = "+ result2);}}