Hi, When you turn off the gsl_error handler, the macro GSL_ERROR will do nothing but return the error code GSL_FAILURE. The gsl_integration_qags does not know the GSL_ERROR is called, and it simply think the function returns -1, which is the value of GSL_FAILURE. That's why the result is always -1.
I do not think it is a bug. Maybe you can write your own error handler to solve your problem. For example, you can use "goto" to jump out of gsl_integration_qags, or set some global variable to indicate the integration result is incorrect. On Wed, Apr 27, 2011 at 2:59 AM, <[email protected]> wrote: > Dear GSL-developer, > > I want to submit this bug-report. I used this code to perform an integration > > #include <stdio.h> > #include <math.h> > #include <gsl/gsl_integration.h> > #include <gsl/gsl_errno.h> > > double f (double x, void * params) { > GSL_ERROR("test error",GSL_FAILURE); > return GSL_NAN; > } > > > > int main (void) > { > gsl_integration_workspace * w = gsl_integration_workspace_alloc (1000); > > double result, error; > > gsl_function F; > F.function = &f; > > gsl_set_error_handler_off(); > int status = gsl_integration_qags (&F, 0, 1, 0, 1e-7, 1000, > w, &result, &error); > > printf ("status = %d\n", status); > status = GSL_FAILURE; > printf ("status = %d\n", status); > > > gsl_integration_workspace_free (w); > > return 0; > } > > However, the integration returns 0 on my system (I use GSL 1.14 compiled > from source on an ubuntu 10.10 machine. > > Best, > > Sebastian Meuren > > > > ---------------------------- Original Message ---------------------------- > Subject: Re: [Help-gsl] Error reporting question > From: "Brian Gough" <[email protected]> > Date: Wed, April 27, 2011 12:37 am > To: [email protected] > Cc: [email protected] > -------------------------------------------------------------------------- > > At Tue, 19 Apr 2011 15:11:27 +0200, > [email protected] wrote: >> >> Dear GSL-users, >> >> I posed the following question >> >> http://stackoverflow.com/questions/5716288/gsl-error-reporting. >> >> However, there seems only little activity concerning GSL questions. >> Therefore I also ask here. Does anybody has a good answer? >> > > To stop an integration with qags try returning NaN from the integrand. > If it does not work please report it to [email protected]. Thanks. > > Brian Gough > > > > > > > > _______________________________________________ > Bug-gsl mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/bug-gsl > _______________________________________________ Bug-gsl mailing list [email protected] https://lists.gnu.org/mailman/listinfo/bug-gsl
