1 2 3 4 5 6 7 8 9 10 11
#include <math.h> double fmin(double a, double b) { if(isNaN(a)) return b; if(isNaN(b)) return a; return a < b ? a : b; }