for gls users

Greg Louis glouis at dynamicro.on.ca
Tue Aug 26 17:22:39 CEST 2003


The recent release (v1.4) of the GNU scientific library contains a new
section with cumulative distribution function support.  I find it's
still necessary to catch integration errors:

#include <gsl/gsl_cdf.h>
#include <gsl/gsl_errno.h>

double prbf(double x, double df)
{
    double p = gsl_cdf_chisq_P(x, df);
    p = max(0.0, 1.0 - p);
    return(min(1.0, p));
}

but this is a lot simpler and more readable than the earlier version.

-- 
| G r e g  L o u i s         | gpg public key: 0x400B1AA86D9E3E64 |
|  http://www.bgl.nu/~glouis |   (on my website or any keyserver) |
|  http://wecanstopspam.org in signatures helps fight junk email. |




More information about the Bogofilter mailing list