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

Proposal: More accurately notation in "rules for parsing floating-point number values". #3375

Open
rh-KIMATA opened this issue Jan 19, 2018 · 5 comments
Labels
clarification Standard could be clearer

Comments

@rh-KIMATA
Copy link

https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#rules-for-parsing-floating-point-number-values

  1. Conversion: Let S be the set of finite IEEE 754 double-precision floating-point values except −0, but with two special values added: 21024 and −21024.
  2. Let rounded-value be the number in S that is closest to
    value, selecting the number with an even significand if there are two equally close values. (The two special values 21024 and −21024 are considered to have even significands for this purpose.)
  3. If rounded-value is 21024 or −21024, return an error.

But −21024 = 21024, because the power exponent is an even number.

"−21024" should be write "−(21024)" or "21024 * -1" for more accurately.

@annevk
Copy link
Member

annevk commented Jan 19, 2018

Per https://en.wikipedia.org/wiki/Order_of_operations this is correct, though apparently there are some programming languages that do it the other way around.

https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type uses the same notation as the HTML Standard.

I suppose we can make sure to clarify this as part of whatwg/infra#87 with an example or some such, to explain that we mean it in the mathematical sense.

@annevk annevk added the clarification Standard could be clearer label Jan 19, 2018
@rh-KIMATA
Copy link
Author

Thanks for your comment.

Per https://en.wikipedia.org/wiki/Order_of_operations this is correct, though apparently there are some programming languages that do it the other way around.

Sorry, I was misunderstand it as "-32 = 9" in mathematically.

I suppose we can make sure to clarify this as part of whatwg/infra#87 with an example or some such, to explain that we mean it in the mathematical sense.

I agree to your plan.

@domenic
Copy link
Member

domenic commented Jan 19, 2018

I don't think we need to repeat mathematical notation in Infra; this is so well-established that I'd rather leave it to places like Wikipedia or math textbooks.

@annevk
Copy link
Member

annevk commented Jan 19, 2018

I was thinking that it might be worth an example due to the potential for confusion with some programming languages and folks copy-and-pasting these numbers mostly into programming languages and not Mathematica.

@domenic
Copy link
Member

domenic commented Jan 19, 2018

I'm not too worried because no programming languages use superscripts to denote exponentiation (except Mathematica).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clarification Standard could be clearer
Development

No branches or pull requests

3 participants