fix(number): fix Infinity casing in Number.prototype.toExponential#5244
Draft
ParthMozarkar wants to merge 3 commits intoboa-dev:mainfrom
Draft
fix(number): fix Infinity casing in Number.prototype.toExponential#5244ParthMozarkar wants to merge 3 commits intoboa-dev:mainfrom
ParthMozarkar wants to merge 3 commits intoboa-dev:mainfrom
Conversation
Test262 conformance changes
Tested main commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5244 +/- ##
===========================================
+ Coverage 47.24% 59.80% +12.56%
===========================================
Files 476 582 +106
Lines 46892 63463 +16571
===========================================
+ Hits 22154 37956 +15802
- Misses 24738 25507 +769 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed Number.prototype.toExponential was failing the test262
return-values.js test and dug into why.
Infinity.toExponential() was returning "infinity" instead of "Infinity"
(-Infinity).toExponential() was returning "-infinity" instead of "-Infinity"
The issue was that the non-finite check was using JsString::from(this_num)
which relies on Rust's default float formatting that produces lowercase
"infinity".
Fixed it by explicitly returning the correct strings "Infinity",
"-Infinity" and "NaN" for non-finite values, matching what the
ECMAScript spec requires.
All existing tests pass.
Fixes #5243