protect history against Infinity and NaN