This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Unusual behaviour in gsl_diff_central?
- From: eknecronzontas <eknecronzontas at yahoo dot com>
- To: gsl-discuss at sources dot redhat dot com
- Date: Tue, 1 Apr 2003 06:36:38 -0800 (PST)
- Subject: Unusual behaviour in gsl_diff_central?
Hello!
I notice that gsl_diff_central seems to fail
for large values of the function argument (see code
below). (I am using gsl 1.3 on Redhat 6.2.) I would
expect it to return a non-zero value in this case,
but it returns zero, in spite of trying to evaluate
the function at x=NaN.
Am I missing something here?
Thanks,
Andrew Steiner
double testfun(double x, void *pa) {
return sin(x);
}
int main(void) {
void *vp=0;
int val;
double res, err;
gsl_function *gslfunc=new gsl_function;
gslfunc->function=testfun;
gslfunc->params=vp;
cout.setf(ios::scientific);
cout.precision(10);
val=gsl_diff_central(gslfunc,1.0e5,&res,&err);
cout << val << " " << res << " " << err << " " <<
cos(1.0e5) << endl;
val=gsl_diff_central(gslfunc,1.0e10,&res,&err);
cout << val << " " << res << " " << err << " " <<
cos(1.0e10) << endl;
return 0;
}
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com