diff --git a/src/Gren/Kernel/String.js b/src/Gren/Kernel/String.js index 6d28f51..9b83895 100644 --- a/src/Gren/Kernel/String.js +++ b/src/Gren/Kernel/String.js @@ -214,7 +214,7 @@ function _String_toInt(str) { if (code < 0x30 || 0x39 < code) { return __Maybe_Nothing; } - total = 10 * total + code - 0x30; + total = 10 * total + (code - 0x30); } return i == start diff --git a/tests/src/Test/String.gren b/tests/src/Test/String.gren index c98a660..4fb0b63 100644 --- a/tests/src/Test/String.gren +++ b/tests/src/Test/String.gren @@ -76,6 +76,10 @@ tests = , badInt "1e31" , badInt "123a" , goodInt "0123" 123 + , goodInt "9007199254740944" 9007199254740944 + , goodInt "9007199254740945" 9007199254740945 + , goodInt "9007199254740991" 9007199254740991 + , goodInt "-9007199254740991" -9007199254740991 , badInt "0x001A" , badInt "0x001a" , badInt "0xBEEF"