Skip to content

Add test for Number.MAX_VALUE's value#5026

Merged
ptomato merged 1 commit intotc39:mainfrom
Sharktheone:number-max-value
Apr 21, 2026
Merged

Add test for Number.MAX_VALUE's value#5026
ptomato merged 1 commit intotc39:mainfrom
Sharktheone:number-max-value

Conversation

@Sharktheone
Copy link
Copy Markdown
Member

Same as for #5025, there where no tests in place for Number.MAX_VALUE's value, so I am adding this here.

I'm directly checking the value against the value mentioned in the spec (1.7976931348623157e+308) as there are no denormalized values we need to take into account here.

The test again passes in Yavashark and I would strongly assume that it will pass in all other engines too.

@Sharktheone Sharktheone requested a review from a team as a code owner April 14, 2026 20:26
assert(Number.MAX_VALUE < Infinity, "Number.MAX_VALUE should be less than Infinity");

assert.sameValue(Number.MAX_VALUE * 2, Infinity, "Number.MAX_VALUE multiplied by 2 should be Infinity");
assert.sameValue(Number.MAX_VALUE, 1.7976931348623157e+308, "Number.MAX_VALUE should be approximately 1.7976931348623157e+308");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get why the spec says "approximately" here but I guess it's OK to use the same language 😄

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure. I don't think any valid impl can use anything different than float64 for it's number type. But I agree, I wasn't sure at first.

@ptomato ptomato merged commit 2d3912c into tc39:main Apr 21, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants