Added check for Infinity and NaN strings.