Use ISO C (1999) isfinite, and correct exit() call