Next: , Previous: , Up: Complex Functions   [Index]


5.10 Miscellaneous Functions

Function: int mpc_urandom (mpc_t rop, gmp_randstate_t state)

Generate a uniformly distributed random complex in the unit square [0, 1] x [0, 1]. Return 0, unless an exponent in the real or imaginary part is not in the current exponent range, in which case that part is set to NaN and a zero value is returned. The second argument is a gmp_randstate_t structure which should be created using the GMP rand_init function, see the GMP manual.

Function: const char * mpc_get_version (void)

Return the GNU MPC version, as a null-terminated string.

Macro: MPC_VERSION
Macro: MPC_VERSION_MAJOR
Macro: MPC_VERSION_MINOR
Macro: MPC_VERSION_PATCHLEVEL
Macro: MPC_VERSION_STRING

MPC_VERSION is the version of GNU MPC as a preprocessing constant. MPC_VERSION_MAJOR, MPC_VERSION_MINOR and MPC_VERSION_PATCHLEVEL are respectively the major, minor and patch level of GNU MPC version, as preprocessing constants. MPC_VERSION_STRING is the version as a string constant, which can be compared to the result of mpc_get_version to check at run time the header file and library used match:

if (strcmp (mpc_get_version (), MPC_VERSION_STRING))
  fprintf (stderr, "Warning: header and library do not match\n");

Note: Obtaining different strings is not necessarily an error, as in general, a program compiled with some old GNU MPC version can be dynamically linked with a newer GNU MPC library version (if allowed by the library versioning system).

Macro: long MPC_VERSION_NUM (major, minor, patchlevel)

Create an integer in the same format as used by MPC_VERSION from the given major, minor and patchlevel. Here is an example of how to check the GNU MPC version at compile time:

#if (!defined(MPC_VERSION) || (MPC_VERSION<MPC_VERSION_NUM(2,1,0)))
# error "Wrong GNU MPC version."
#endif

Next: , Previous: , Up: Complex Functions   [Index]