Handle Infinity in Number parsing#331
Conversation
- Accept `Infinity` and signed variants in `Number.parseFloat` - Keep `Number.parseInt` returning `NaN` for Infinity literals - Update the decimal parser to recognize the `Infinity` literal
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe pull request adds support for parsing special numeric literals ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Suite Timing
Measured on ubuntu-latest x64. |
Benchmark Results364 benchmarks Interpreted: 🟢 132 improved · 🔴 46 regressed · 186 unchanged · avg +2.6% arraybuffer.js — Interp: 🟢 3, 🔴 1, 10 unch. · avg +0.3% · Bytecode: 🟢 2, 🔴 5, 7 unch. · avg -2.6%
arrays.js — Interp: 🟢 5, 14 unch. · avg +2.0% · Bytecode: 🔴 18, 1 unch. · avg -6.4%
async-await.js — Interp: 🟢 2, 4 unch. · avg +2.9% · Bytecode: 🔴 3, 3 unch. · avg -2.4%
base64.js — Interp: 🔴 1, 9 unch. · avg +0.6% · Bytecode: 🔴 9, 1 unch. · avg -6.3%
classes.js — Interp: 🟢 11, 20 unch. · avg +2.0% · Bytecode: 🟢 4, 🔴 9, 18 unch. · avg +0.1%
closures.js — Interp: 🟢 2, 🔴 2, 7 unch. · avg +0.4% · Bytecode: 🔴 10, 1 unch. · avg -6.7%
collections.js — Interp: 🟢 7, 5 unch. · avg +1.7% · Bytecode: 🔴 8, 4 unch. · avg -5.6%
destructuring.js — Interp: 🟢 10, 🔴 1, 11 unch. · avg +2.3% · Bytecode: 🔴 16, 6 unch. · avg -4.2%
fibonacci.js — Interp: 🟢 1, 7 unch. · avg +0.2% · Bytecode: 🔴 6, 2 unch. · avg -6.1%
float16array.js — Interp: 🟢 10, 🔴 3, 19 unch. · avg +1.5% · Bytecode: 🟢 10, 🔴 12, 10 unch. · avg +0.0%
for-of.js — Interp: 🟢 4, 3 unch. · avg +2.0% · Bytecode: 🟢 1, 🔴 3, 3 unch. · avg -1.1%
helpers/bench-module.js — Interp: 0 · Bytecode: 0
iterators.js — Interp: 🟢 3, 🔴 18, 21 unch. · avg -1.9% · Bytecode: 🟢 9, 🔴 8, 25 unch. · avg +0.6%
json.js — Interp: 🟢 13, 7 unch. · avg +5.0% · Bytecode: 🔴 16, 4 unch. · avg -6.6%
jsx.jsx — Interp: 🟢 5, 16 unch. · avg +2.5% · Bytecode: 🔴 7, 14 unch. · avg -2.0%
modules.js — Interp: 🟢 2, 7 unch. · avg +1.7% · Bytecode: 🔴 7, 2 unch. · avg -10.4%
numbers.js — Interp: 🟢 6, 🔴 2, 3 unch. · avg +2.2% · Bytecode: 🔴 11 · avg -7.3%
objects.js — Interp: 🟢 4, 3 unch. · avg +2.4% · Bytecode: 🔴 3, 4 unch. · avg -2.6%
promises.js — Interp: 🔴 1, 11 unch. · avg -0.7% · Bytecode: 🔴 3, 9 unch. · avg -1.9%
regexp.js — Interp: 🟢 7, 🔴 1, 3 unch. · avg +1.3% · Bytecode: 🟢 1, 🔴 4, 6 unch. · avg -2.9%
strings.js — Interp: 🟢 3, 🔴 16 · avg -28.9% · Bytecode: 🟢 4, 🔴 9, 6 unch. · avg +8.9%
typed-arrays.js — Interp: 🟢 18, 4 unch. · avg +2.9% · Bytecode: 🟢 10, 🔴 11, 1 unch. · avg +1.2%
uint8array-encoding.js — Interp: 🟢 16, 2 unch. · avg +56.6% · Bytecode: 🟢 7, 🔴 7, 4 unch. · avg +12.4%
Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
Summary
Number.parseFloatcoverage forInfinity, signed infinity, and surrounding whitespace.Number.parseIntcoverage to verifyInfinityforms still returnNaN.Infinityliteral during decimal parsing.