-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Conversation
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. |
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. |
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.) |
There was a problem hiding this comment.
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
.
Will there ever be implementation-approximated non-Number values? |
@ljharb There is one in this PR. |
ah, an integer MV. and you think the boilerplate of "Number" is useful versus having it be the default, given its frequency? |
Yeah, I wouldn't want everything described as "implementation-approximated" to also be implied to be a Number value, even if they all were. |
1102b66
to
01a6d27
Compare
This is normative but I believe it was always what was intended, so we shouldn't need consensus on it.