Module Sundials.Util

module Util: sig .. end

Shared definitions and miscellaneous utility functions.


type error_details = {
   error_code : int;
   module_name : string; (*

IDA, CVODE, CVSPGMR, etc.

*)
   function_name : string;
   error_message : string;
}

Information passed to registered error handler functions. See Cvode.set_err_handler_fn, Ida.set_err_handler_fn, and Kinsol.set_err_handler_fn.

Miscellaneous utility functions

val format_float : string -> float -> string

format_float fmt f formats f according to the format string fmt. It uses the low-level caml_format_float function.

val floata : float -> string

Returns the bit-level representation of a float in hexadecimal as a string. Equivalent to format_float "%a".

val compare_float : ?tol:float -> float -> float -> bool

Returns true if the relative difference of the two arguments is less than or equal to the tolerance. The tolerance defaults to 10 times Sundials_Config.unit_roundoff. This function handles the cases where the arguments are near zero and where either is Float.infinity or Float.nan.