Utility functions.
More...
Utility functions.
- Author
- Ben Bornstein
◆ util_epsilon()
- Returns
- the machine epsilon
◆ util_free()
void util_free |
( |
void * |
element | ) |
|
Function for freeing memory allocated by libSBML functions.
- Parameters
-
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().
- Note
- This function is only necessary when using a version of libSBML compiled and linked against a static MSVC runtime library.
◆ util_freeArray()
void util_freeArray |
( |
void ** |
objects, |
|
|
int |
length |
|
) |
| |
Function for freeing memory allocated by libSBML functions.
- Parameters
-
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 length;
free(supported);
class SBMLNamespaces SBMLNamespaces_t
Definition: sbmlfwd.h:377
- Note
- This function is only necessary when using a version of libSBML compiled and linked against a static MSVC runtime library.
◆ util_isEqual()
int util_isEqual |
( |
double |
a, |
|
|
double |
b |
|
) |
| |
- Returns
- 1 if the number are equal up to the machine epsilon and 0 otherwise.
◆ util_isFinite()
int util_isFinite |
( |
double |
d | ) |
|
- Returns
- 1 if the number is finite and 0 otherwise.
◆ util_isInf()
int util_isInf |
( |
double |
d | ) |
|
Function for testing whether a given value represents negative infinity.
- Parameters
-
d | the floating-point value to test. |
- Returns
-1
(for false) if d
represents negative infinity, 1
(true) if d
represents positive infinity, and 0
(false) otherwise.
◆ util_isNaN()
int util_isNaN |
( |
double |
d | ) |
|
- Returns
- 1 if the number is NaN and 0 otherwise.
◆ util_isNegZero()
int util_isNegZero |
( |
double |
d | ) |
|
Function for testing whether a given value represents negative zero.
- Parameters
-
d | the floating-point value to test. |
- Returns
1
(true) if d
is an IEEE-754 negative zero, 0
(false) otherwise.
◆ util_NaN()
Returns a representation of NaN
.
- Returns
- a (quiet) NaN.
◆ util_NegInf()
double util_NegInf |
( |
void |
| ) |
|
Returns a representation of the IEEE-754 "Negative Infinity" value.
- Returns
- IEEE-754 Negative Infinity.
◆ util_NegZero()
double util_NegZero |
( |
void |
| ) |
|
Returns a representation of the IEEE-754 "Negative Zero" value.
- Returns
- IEEE-754 Negative Zero.
◆ util_PosInf()
double util_PosInf |
( |
void |
| ) |
|
Returns a representation of the IEEE-754 "Positive Infinity" value.
- Returns
- IEEE-754 Positive Infinity