Re: How to overload == for System.Double
Marc Brooks <[email protected]> Fri, 2 Feb 2007 11:47:41 -0600
| Newsgroups | gmane.comp.windows.devel.dotnet.cx |
|---|---|
| Message-ID | <[email protected]> |
> FYI, there are Double.Epsilon and Single.Epsilon fields re tollerance. Which is the smallest value that can be added/subtracted FROM ZERO that will give a different result. Thus it's only applicable when you are near zero... If you subtract two large numbers, where the Mantissa of the float is shifted far enough away from 1 that there are lost bits of precision, then comparing two values may give you surprising results. Check this article: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm -- "I am Dyslexic of Borg. Resistors are fertile. Prepare to have your ass laminated." -- Dan Nitschke Marc C. Brooks http://musingmarc.blogspot.com =================================== This list is hosted by DevelopMentor® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com