What's the best way to compare doubles? I am testing a method that should
return the fraction 2/9. For my expected result, I entered 0.222222 (a six
decimal place representation of 2/9). The CLR resolved the fraction to full
precision, so I got this error back from my test:
expected:<0.222222>
but was:<0.222222222222222>
For my purposes, the two values are equal.
The Double.Epsilon constant is too small to use for an epsilon comparison
here. So, is my only option to create my own epsilon constant as 0.00001? Or
is there another solution to this problem that I am missing? Thanks in
advance
David Veeneman
Foresight Systems