package gsl

  1. Overview
  2. Docs

Error reporting

val version : string

Version of GSL library.

type errno =
  1. | CONTINUE
    (*

    iteration has not converged

    *)
  2. | FAILURE
  3. | EDOM
    (*

    input domain error, e.g sqrt(-1)

    *)
  4. | ERANGE
    (*

    output range error, e.g. exp(1e100)

    *)
  5. | EFAULT
    (*

    invalid pointer

    *)
  6. | EINVAL
    (*

    invalid argument supplied by user

    *)
  7. | EFAILED
    (*

    generic failure

    *)
  8. | EFACTOR
    (*

    factorization failed

    *)
  9. | ESANITY
    (*

    sanity check failed - shouldn't happen

    *)
  10. | ENOMEM
    (*

    malloc failed

    *)
  11. | EBADFUNC
    (*

    problem with user-supplied function

    *)
  12. | ERUNAWAY
    (*

    iterative process is out of control

    *)
  13. | EMAXITER
    (*

    exceeded max number of iterations

    *)
  14. | EZERODIV
    (*

    tried to divide by zero

    *)
  15. | EBADTOL
    (*

    user specified an invalid tolerance

    *)
  16. | ETOL
    (*

    failed to reach the specified tolerance

    *)
  17. | EUNDRFLW
    (*

    underflow

    *)
  18. | EOVRFLW
    (*

    overflow

    *)
  19. | ELOSS
    (*

    loss of accuracy

    *)
  20. | EROUND
    (*

    failed because of roundoff error

    *)
  21. | EBADLEN
    (*

    matrix, vector lengths are not conformant

    *)
  22. | ENOTSQR
    (*

    matrix not square

    *)
  23. | ESING
    (*

    apparent singularity detected

    *)
  24. | EDIVERGE
    (*

    integral or series is divergent

    *)
  25. | EUNSUP
    (*

    requested feature is not supported by the hardware

    *)
  26. | EUNIMPL
    (*

    requested feature not (yet) implemented

    *)
  27. | ECACHE
    (*

    cache limit exceeded

    *)
  28. | ETABLE
    (*

    table limit exceeded

    *)
  29. | ENOPROG
    (*

    iteration is not making progress towards solution

    *)
  30. | ENOPROGJ
    (*

    jacobian evaluations are not improving the solution

    *)
  31. | ETOLF
    (*

    cannot reach the specified tolerance in F

    *)
  32. | ETOLX
    (*

    cannot reach the specified tolerance in X

    *)
  33. | ETOLG
    (*

    cannot reach the specified tolerance in gradient

    *)
  34. | EOF
    (*

    end of file

    *)
exception Gsl_exn of errno * string

Error.Gsl_exn is raised by GSL to indicate an error. The second argument gives the reason for the error.

val init : unit -> unit

Error.init () setups the GSL error handler so that the OCaml function Error.handler gets called in case of an error. This behavior is the default now.

val uninit : unit -> unit

Error.uninit () reverts the GSL error handler to the default of the GSL C-library. The default GSL error simply aborts the program.

val handler : (errno -> string -> unit) Pervasives.ref

The OCaml handler for GSL errors. Initially set to Error.default_handler. If the function returns, the error is ignored and execution of the GSL function continues.

Redefine it so as to ignore some particular errors (EOVRFLW or EUNDRFLW for instance).

val default_handler : errno -> string -> 'a

The default OCaml handler for GSL errors. It simply raises the Error.Gsl_exn exception.

val strerror : errno -> string

strerror e returns a description of the error e.

val string_of_errno : errno -> string

string_of_errno e returns the name of e.

val printer : exn -> string option

printer is an exceoption printer for Exn. It is registered by default with Printexc.