This section describes how the GSL modules handle errors reported by the GSL library.
The following GSL error codes are defined by the gsl
module:
   GSL_EDOM        input domain error, e.g sqrt(-1)
   GSL_ERANGE      output range error, e.g. exp(1e100)
   GSL_EFAULT      invalid pointer
   GSL_EINVAL      invalid argument supplied by user
   GSL_EFAILED     generic failure
   GSL_EFACTOR     factorization failed
   GSL_ESANITY     sanity check failed - shouldn't happen
   GSL_ENOMEM      malloc failed
   GSL_EBADFUNC    problem with user-supplied function
   GSL_ERUNAWAY    iterative process is out of control
   GSL_EMAXITER    exceeded max number of iterations
   GSL_EZERODIV    tried to divide by zero
   GSL_EBADTOL     user specified an invalid tolerance
   GSL_ETOL        failed to reach the specified tolerance
   GSL_EUNDRFLW    underflow
   GSL_EOVRFLW     overflow
   GSL_ELOSS       loss of accuracy
   GSL_EROUND      failed because of roundoff error
   GSL_EBADLEN     matrix, vector lengths are not conformant
   GSL_ENOTSQR     matrix not square
   GSL_ESING       apparent singularity detected
   GSL_EDIVERGE    integral or series is divergent
   GSL_EUNSUP      requested feature is not supported by the hardware
   GSL_EUNIMPL     requested feature not (yet) implemented
   GSL_ECACHE      cache limit exceeded
   GSL_ETABLE      table limit exceeded
   GSL_ENOPROG     iteration is not making progress towards solution
   GSL_ENOPROGJ    jacobian evaluations are not improving the solution
   GSL_ETOLF       cannot reach the specified tolerance in F
   GSL_ETOLX       cannot reach the specified tolerance in X
   GSL_ETOLG       cannot reach the specified tolerance in gradient
   GSL_EOF         end of file
The gsl_set_error_disposition function may be used to indicate
how the module is to handle a specified error. It takes two
arguments: an error code and a value controlling how the
error is to be handled:
    gsl_set_error_disposition (error_code, control_value)
    gsl_set_error_disposition (GSL_EDOM, -1);
    gsl_set_error_disposition (GSL_EUNDRFLW, 0);
Alternatively, the control value may be the reference to a function to be called when the specified error occurs. The function will be passed two arguments: a string whose value is the function name generating the error and the error code itself, e.g.,
    static define edom_callback (fname, err_code)
    {
       vmessage ("%s: domain error.", fname);
    }
    gsl_set_error_disposition (GSL_EDOM, &edom_callback);
    y = log_1plusx (-10);
"log_1plusx: domain error.".
By default, all errors will generate exceptions except for the following, which will generate warnings:
   GSL_EDOM
   GSL_ERANGE
   GSL_EUNDRFLW
   GSL_EOVRFLW