Real Number Rounding Error Comparision And Equality C# with Example
using System; namespace CSharpFundamentals { class RealNumberRoundingErrorComparisionAndEquality { private static void Main(string[] args) { decimal m = 1M/6M; double d = 1.0/6.0; decimal notQuiteWholeM = m+m+m+m+m+m; double notQuiteWholeD = d+d+d+d+d+d; Console.WriteLine("notQuiteWholeM == 1M : {0}",notQuiteWholeM == 1M); Console.WriteLine("notQuiteWholeD < 1.0: {0}", notQuiteWholeD < 1.0); } } }