Don't use the finite() function, it's deprecated and causes ugly warnings when compiling (Mac OS X).
Replace it with the standard isfinite function instead.
Same as D3961 but without whitespace changes.
(As far as I know there is no "upstream" version of elbeem - the other source for elbeem is sourceforge which looks dead)