DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

fmax(S)


fmax, fmin -- return maximum/minimum numeric value of two arguments

Syntax

   cc [flag ...] file ...  -lm [library ...]
   

#include <math.h>

double fmax(double x, double y);

float fmaxf(float x, float y);

long double fmaxl(long double x, long double y);

double fmin(double x, double y);

float fminf(float x, float y);

long double fminl(long double x, long double y);

Description

fmax, fmaxf and fmaxl return the larger value of the x and y arguments. NaN arguments are treated as missing data, if only one of the arguments is NaN and the other is numeric, the functions will return the numeric argument as the max value.

fmin, fminf and fminl return the smaller value of the x and y arguments. NaN arguments are treated as missing data, if only one of the arguments is NaN and the other is numeric, the functions will return the numeric argument as the min value.

Errors

On systems that support IEEE NaN, if the argument to any of these functions is a quiet NaN, that value is returned. If the argument is a signaling NaN, a quiet NaN is returned and the invalid operation exception is raised. In either case, errno is set to EDOM.

If the program was compiled with the -Xt compilation mode, a value that will compare equal to HUGE is returned instead of HUGE_VAL. These error handling procedures may be changed with the function matherr.

See also

cc(CP), math(M), matherr(S)
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003