fmin/fmax

hi, need to write fmin and fmax functions
can anyhelp help implementing?

would this work?

double fmin(double a,double b)
{
return (a<b)?a:b;
}

double fmax(double a,double b)
{
return (b<a)?a:b;
}

thanks
Yes, except I would say a fmax() would read better as a>b rather than b<a. The former is instantly understandable while the latter takes a moment for one to recognize and process.
Topic archived. No new replies allowed.