Add include <math.h>. It defines isnan() and isinf().
Add workaround for missing RETURN_SIZED_ENUMERATOR macro in Ruby < 2.0.