Speedup of NaN/INF check