0

Possible Duplicate:
Floating point comparison functions for C#

I've read about all the problems with floating point precision and from what I've read the answer is in rounding. In my situation I have a double that has a value of .07 which actually stores as .070000000000000007. I need to compare .07 to a RGN between 0 and 1 that is also a double. The way I have resolved the problem is to round both numbers to 15 digits and then comapre them. Is this the correct way to do this?

Math.Round(RGN, 15) >= Math.Round(double, 15)

Thanks for the help!!

Gary

Community
  • 1
  • 1
Gary
  • 1,784
  • 4
  • 18
  • 38

0 Answers0