Use finite() or isfinite() depending on which one you have. Fix a typo.

C99 declares isfinite() but not everyone has it, while finite() is older.
Fixed warning about possible use of uninitialized i