[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [*] Re: [Help-gsl] Approximate Comparison of Floating Point Numbers

From: Awhan Patnaik
Subject: Re: [*] Re: [Help-gsl] Approximate Comparison of Floating Point Numbers
Date: Thu, 18 Jun 2009 11:28:51 +0530

On Fri, Jun 5, 2009 at 7:14 PM, Brian Gough <address@hidden> wrote:

> At Tue, 2 Jun 2009 13:34:39 +0530,
> Awhan Patnaik wrote:
> >
> > With reference to int gsl_fcmp (double x, double y, double
> > epsilon) is there a default choice of epsilon that will work for
> > ``almost" all situations ?
> I think this really depends on the context, there is a discussion in
> Knuth which is the starting point and is worth checking out.

According to the definition of DBL_EPSILON

"Difference between 1 and the least value greater than 1 that is
representable. ". I was hoping that this would be a generic choice of
epsilon that would allow any computer to resolve between two floating point

I have a code where I have to compare a lot of floating point numbers. In
most of the previous cases the ranges were in the  > 1.0 range but I soon
ran into a situation where I had to compare numbers of the order 1e-6 and
there I began to worry about the accuracy of my code.

Is there a way in which one can choose a context independent epsilon ?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]