Re: How to overload == for System.Double

Alan Baljeu <[email protected]> Fri, 2 Feb 2007 11:14:52 -0500
Newsgroups gmane.comp.windows.devel.dotnet.cx
Message-ID <087a01c746e5$484d5070$1dc80ac6@CTI>
Epsilon isn't really the point.  Tolerant comparison is about acknowledging how much error
you expect and allow in your arithmetic operations due to floating-point roundoff.  I
mention 1e-6 as an example number I would use in double comparisons for a particular
scenario, even though Double.Epsilon is much different.

> -----Original Message-----
> From: Discussion relating to the specifics of the C# and
> Managed C++ languages [mailto:[email protected]]
> On Behalf Of Stoyan Damov
> Sent: Friday, February 02, 2007 10:56 AM
> To: [email protected]
> Subject: Re: [DOTNET-CX] How to overload == for System.Double
>
> On 2/2/07, Alan Baljeu <[email protected]> wrote:
> > On some architectures, the same float can have different
> > representations, and similar floats can have quite different
> > representations.  Given that, is this implementation
> totally reliable,
> > and has it been seriously tested?  Besides that, is it really much
> > better than
> > Math.Abs(a-b) < 1e-6 (or whatever tolerance you want to apply)?
> >
>
> FYI, there are Double.Epsilon and Single.Epsilon fields re tollerance.
>
> Cheers
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com