fixed number detection heuristics to handle nan/inf and numbers that have been used in string context correctly