We use java.lang.Double.parseDouble(String) in JSType.toNumber(String). However, that method allows some characters such as trailing 'f' or 'd' that are not allowed by ECMA spec (9.3.1): "0.5d" "1f" We need to improve our checks. This may also help improve performance as more input strigns are converted to NaN without a NumberFormatException being thrown.