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


4.7 Maximum and Minimum functions

Note that the following macros perform multiple evaluations of their arguments, so they should not be used with arguments that have side effects (such as a call to a random number generator).

Macro: GSL_MAX (a, b)

This macro returns the maximum of a and b. It is defined as ((a) > (b) ? (a):(b)).

Macro: GSL_MIN (a, b)

This macro returns the minimum of a and b. It is defined as ((a) < (b) ? (a):(b)).

Function: extern inline double GSL_MAX_DBL (double a, double b)

This function returns the maximum of the double precision numbers a and b using an inline function. The use of a function allows for type checking of the arguments as an extra safety feature. On platforms where inline functions are not available the macro GSL_MAX will be automatically substituted.

Function: extern inline double GSL_MIN_DBL (double a, double b)

This function returns the minimum of the double precision numbers a and b using an inline function. The use of a function allows for type checking of the arguments as an extra safety feature. On platforms where inline functions are not available the macro GSL_MIN will be automatically substituted.

Function: extern inline int GSL_MAX_INT (int a, int b)
Function: extern inline int GSL_MIN_INT (int a, int b)

These functions return the maximum or minimum of the integers a and b using an inline function. On platforms where inline functions are not available the macros GSL_MAX or GSL_MIN will be automatically substituted.

Function: extern inline long double GSL_MAX_LDBL (long double a, long double b)
Function: extern inline long double GSL_MIN_LDBL (long double a, long double b)

These functions return the maximum or minimum of the long doubles a and b using an inline function. On platforms where inline functions are not available the macros GSL_MAX or GSL_MIN will be automatically substituted.


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