This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: sorting: compare_doubles()
- From: Brian Gough <bjg at network-theory dot co dot uk>
- To: Pasquale Tricarico <pasquale dot tricarico at pd dot infn dot it>
- Cc: gsl-discuss at sources dot redhat dot com
- Date: Thu, 6 Dec 2001 20:48:36 +0000 (GMT)
- Subject: Re: sorting: compare_doubles()
- References: <3C0FA79D.4566A778@pd.infn.it>
Pasquale Tricarico writes:
> Probably there is a bug in the compare_doubles() function, as
> written
> in the documentation of the 1.0 release. It's form is:
> int compare_doubles (const double * a, const double * b) {
> return (int) (*a - *b);
> }
> This function returns -1,0 or +1 depending on the values assumed
> by *a and *b, except in the case of two doubles with an absolute
> difference smaller than one; i.e.:
> in this case, the function will return ((int)0.4), that is equal
> to
> zero, even if the two doubles are different!!
Hi,
Thanks for the bug report. Well spotted, it should be changed. (I
copied that example out of the GNU C Library manual by the way).
regards
Brian