Doubles cannot be compared without specifying an acceptable error
// A double extensions class. public static class DoubleExtensions { public static bool IsEqualTo( this double val1, double val2, double resolution ) // Resolution of the double comparison, specifies an acceptable error level { double compare = Math.Abs( val1 - val2 ); bool res = compare < resolution; return res; } }
No comments:
Post a Comment