Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tointlmathematicalvalue tests #3772

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

romulocintra
Copy link
Member

@romulocintra romulocintra requested a review from a team as a code owner January 18, 2023 12:31
@romulocintra romulocintra added the ECMA-402 ECMA-402 related PRs label Jan 18, 2023
Copy link
Contributor

@sffc sffc left a comment

Choose a reason for hiding this comment

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

Thanks, @romulocintra!

@romulocintra romulocintra requested review from sffc and ryzokuken and removed request for sffc February 2, 2023 16:14
---*/

const nf = Intl.NumberFormat();

Copy link
Contributor

@sffc sffc Feb 2, 2023

Choose a reason for hiding this comment

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

This PR currently tests only the Number path. Please also test the String path.

Please test the following inputs (and, for additional coverage, the negative versions of each):

// Values that should *not* overflow to ∞:
Number.MAX_VALUE
String(Number.MAX_VALUE)
Number.MAX_VALUE / 2
String(Number.MAX_VALUE / 2)
1e308
"1e308"
"1" + Array(308).fill("0").join("")
Array(309).fill("1").join("")

// Values that should overflow to ∞:
Number.MAX_VALUE * 2
1e309
"1e309"
"1" + Array(309).fill("0").join("")
Array(310).fill("1").join("")

// Values that should *not* underflow to 0:
// Note: Please set the rounding strategy to maximumSignificantDigits: 10
Number.MIN_VALUE
String(Number.MIN_VALUE)
Number.MIN_VALUE * 2
String(Number.MIN_VALUE * 2)
1e-324
"1e-324"
"1.1111111111111111111e-324" // should round to 10 significant digits
"0." + Array(323).fill("0").join("") + "1"
"0." + Array(323).fill("0").join("") + Array(30).fill("1").join("") // should round to 10 significant digits

// Values that should underflow to zero:
Number.MIN_VALUE / 2
1e-325
"1e-325"
"1.1111111111111111111e-325"
"0." + Array(324).fill("0").join("") + "1"
"0." + Array(324).fill("0").join("") + Array(30).fill("1").join("")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting author ECMA-402 ECMA-402 related PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants