Use Gnulib's `isnan' and `isinf' modules.