Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing Doubles 1

Status
Not open for further replies.

BoulderBum

Programmer
Jul 11, 2002
2,179
US
In other languages, you shouldn't use comparison operators with doubles to check for equality because of slight rounding errors.

Does .NET have a built-in way to test for the "equality" of doubles, or is the standard still to check for differences greater than a near zero number?
 
You should compare the absolute value of the difference between two Double objects with Double.Epsilon.
If the difference is less than Double.Epsilon then the both double are equal.
-obislavu-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top