Try cmath over math.h (gcc/gcc's stdlib has isfinite weirdness)