libSBML C API
5.18.0
|
Utility functions. More...
Macros | |
#define | __DBL_EPSILON__ DBL_EPSILON |
Functions | |
void | util_free (void *element) |
Function for freeing memory allocated by libSBML functions. More... | |
void | util_freeArray (void **objects, int length) |
Function for freeing memory allocated by libSBML functions. More... | |
int | util_isInf (double d) |
Function for testing whether a given value represents negative infinity. More... | |
int | util_isNegZero (double d) |
Function for testing whether a given value represents negative zero. More... | |
double | util_NaN (void) |
Returns a representation of NaN . More... | |
double | util_NegInf (void) |
Returns a representation of the IEEE-754 "Negative Infinity" value. More... | |
double | util_NegZero (void) |
Returns a representation of the IEEE-754 "Negative Zero" value. More... | |
double | util_PosInf (void) |
Returns a representation of the IEEE-754 "Positive Infinity" value. More... | |
Utility functions.
Ths file implements a small number of utility functions that may be useful inside and outside of libSBML.
#define __DBL_EPSILON__ DBL_EPSILON |
void util_free | ( | void * | element | ) |
Function for freeing memory allocated by libSBML functions.
element | pointer to the object to be freed. It must be data that was originally allocated by a libSBML function. |
This function was introduced to deal with a specific memory issue arising on Windows OS when using libSBML compiled against a static MSVC runtime library. In this situation, it was not possible to use the standard free()
function when freeing memory that was actually allocated within the libSBML function call. The following is an example of where the free function fails and needs to be replaced with util_free().
void util_freeArray | ( | void ** | objects, |
int | length | ||
) |
Function for freeing memory allocated by libSBML functions.
objects | pointer to the array to be freed. It must be data that was originally allocated by a libSBML function. |
length | number of elements in the array to be freed. |
This function was introduced to deal with a specific memory issue arising on Windows OS when using libSBML compiled against a static MSVC runtime library. In this situation, it was not possible to use the standard free()
function when freeing memory that was actually allocated within the libSBML function call. The following is an example of where the free function fails and needs to be replaced with util_freeArray().
int util_isInf | ( | double | d | ) |
Function for testing whether a given value represents negative infinity.
d | the floating-point value to test. |
-1
(for false) if d
represents negative infinity, 1
(true) if d
represents positive infinity, and 0
(false) otherwise. int util_isNegZero | ( | double | d | ) |
Function for testing whether a given value represents negative zero.
d | the floating-point value to test. |
1
(true) if d
is an IEEE-754 negative zero, 0
(false) otherwise. double util_NaN | ( | void | ) |
Returns a representation of NaN
.
double util_NegInf | ( | void | ) |
Returns a representation of the IEEE-754 "Negative Infinity" value.
double util_NegZero | ( | void | ) |
Returns a representation of the IEEE-754 "Negative Zero" value.
double util_PosInf | ( | void | ) |
Returns a representation of the IEEE-754 "Positive Infinity" value.