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

Normative: require implementation-approximated numeric methods to return a Number value #2523

Merged
merged 1 commit into from
Oct 15, 2021

Conversation

michaelficarra
Copy link
Member

This is normative but I believe it was always what was intended, so we shouldn't need consensus on it.

@michaelficarra michaelficarra added the normative change Affects behavior required to correctly evaluate some ECMAScript source text label Sep 17, 2021
@michaelficarra michaelficarra requested a review from a team September 17, 2021 16:20
@bakkot
Copy link
Contributor

bakkot commented Sep 17, 2021

Every math function also returns "an implementation-approximated value" rather than "an implementation-approximated Number value". I think it would be better for "implementation-approximated" to imply Number. That's how I understood it, certainly.

@michaelficarra
Copy link
Member Author

I don't think it's clear that "implementation-approximated value" implies that it's a Number value. I'll add the other cases to this PR.

@michaelficarra michaelficarra changed the title Normative: require Number::exponentiate to return a Number value Normative: require implementation-approximated numeric methods to return a Number value Sep 17, 2021
spec.html Outdated
@@ -28182,7 +28182,7 @@ <h1>parseInt ( _string_, _radix_ )</h1>
1. If _S_ contains a code unit that is not a radix-_R_ digit, let _end_ be the index within _S_ of the first such code unit; otherwise, let _end_ be the length of _S_.
1. Let _Z_ be the substring of _S_ from 0 to _end_.
1. If _Z_ is empty, return *NaN*.
1. Let _mathInt_ be the integer value that is represented by _Z_ in radix-_R_ notation, using the letters <b>A</b>-<b>Z</b> and <b>a</b>-<b>z</b> for digits with values 10 through 35. (However, if _R_ is 10 and _Z_ contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if _R_ is not 2, 4, 8, 10, 16, or 32, then _mathInt_ may be an implementation-approximated value representing the integer value that is represented by _Z_ in radix-_R_ notation.)
1. Let _mathInt_ be the integer value that is represented by _Z_ in radix-_R_ notation, using the letters <b>A</b>-<b>Z</b> and <b>a</b>-<b>z</b> for digits with values 10 through 35. (However, if _R_ is 10 and _Z_ contains more than 20 significant digits, every significant digit after the 20th may be replaced by a 0 digit, at the option of the implementation; and if _R_ is not 2, 4, 8, 10, 16, or 32, then _mathInt_ may be an implementation-approximated integer representing the integer value denoted by _Z_ in radix-_R_ notation.)
Copy link
Member Author

Choose a reason for hiding this comment

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

On this line, I've also adopted the "denoted by" wording we use in RoundMVResult.

@ljharb
Copy link
Member

ljharb commented Sep 17, 2021

Will there ever be implementation-approximated non-Number values?

@michaelficarra
Copy link
Member Author

@ljharb There is one in this PR.

@ljharb
Copy link
Member

ljharb commented Sep 17, 2021

ah, an integer MV. and you think the boilerplate of "Number" is useful versus having it be the default, given its frequency?

@michaelficarra
Copy link
Member Author

Yeah, I wouldn't want everything described as "implementation-approximated" to also be implied to be a Number value, even if they all were.

@michaelficarra michaelficarra added the editor call to be discussed in the next editor call label Oct 11, 2021
@michaelficarra michaelficarra added ready to merge Editors believe this PR needs no further reviews, and is ready to land. and removed editor call to be discussed in the next editor call labels Oct 13, 2021
@ljharb ljharb force-pushed the exponentiate-returns-Number branch from 1102b66 to 01a6d27 Compare October 15, 2021 05:29
@ljharb ljharb merged commit 01a6d27 into master Oct 15, 2021
@ljharb ljharb deleted the exponentiate-returns-Number branch October 15, 2021 05:33
mathiasbynens pushed a commit to mathiasbynens/ecma262 that referenced this pull request Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
normative change Affects behavior required to correctly evaluate some ECMAScript source text ready to merge Editors believe this PR needs no further reviews, and is ready to land.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants