Where are MIN and MAX defined in C, if at all?
MIN
MAX
What is the best way to implement these, as generically and type safely as possible? (Compil
The maximum of two integers a and b is (int)(0.5((a+b)+abs(a-b))). This may also work with (double) and fabs(a-b) for doubles (similar for floats)
a
b
(int)(0.5((a+b)+abs(a-b)))
(double)
fabs(a-b)