Next: , Previous: Special Function Usage, Up: Special Functions


7.2 The gsl_sf_result struct

The error handling form of the special functions always calculate an error estimate along with the value of the result. Therefore, structures are provided for amalgamating a value and error estimate. These structures are declared in the header file gsl_sf_result.h.

The gsl_sf_result struct contains value and error fields.

     typedef struct
     {
       double val;
       double err;
     } gsl_sf_result;

The field val contains the value and the field err contains an estimate of the absolute error in the value.

In some cases, an overflow or underflow can be detected and handled by a function. In this case, it may be possible to return a scaling exponent as well as an error/value pair in order to save the result from exceeding the dynamic range of the built-in types. The gsl_sf_result_e10 struct contains value and error fields as well as an exponent field such that the actual result is obtained as result * 10^(e10).

     typedef struct
     {
       double val;
       double err;
       int    e10;
     } gsl_sf_result_e10;

The GNU Scientific Library - a free numerical library licensed under the GNU GPL
Back to the GNU Scientific Library Homepage