Where are MIN and MAX defined in C, if at all?
What is the best way to implement these, as generically and type safely as possible? (Compil
It's worth pointing out I think that if you define min and max with the ternary operation such as
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
then to get the same result for the special case of fmin(-0.0,0.0) and fmax(-0.0,0.0) you need to swap the arguments
fmax(a,b) = MAX(a,b)
fmin(a,b) = MIN(b,a)