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

Correct interpretation of mathematical value #72

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion numberformat/diff.emu
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,9 @@
1. Else,
1. Let _str_ be ! Number::toString(_x_).
1. If the grammar cannot interpret _str_ as an expansion of |StringNumericLiteral|, return *NaN*.
1. Let _mv_ be the MV, a mathematical value, of ? ToNumber(_str_), as described in <emu-xref href="#sec-runtime-semantics-mv-s"></emu-xref>.
1. Let _text_ be ! StringToCodePoints(_str_).
1. Let _literal_ be ParseText(_text_, |StringNumericLiteral|).
Copy link
Member

Choose a reason for hiding this comment

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

Hello @jugglinmike thanks for your PR, it might be nice to update grammar according to @bakkot suggestion and also add this check?

Suggested change
1. Let _literal_ be ParseText(_text_, |StringNumericLiteral|).
1. Let _literal_ be ParseText(_text_, |StringNumericLiteral|).
1. If _literal_ is a List of errors, let _mv_ be *NaN*.

Thanks again 🙏🙏

1. Let _mv_ be the MV of _literal_.
1. If _mv_ is 0 and the first non white space code point in _str_ is `-`, return *-0*.
1. If _mv_ is 10<sup>10000</sup> and _str_ contains `Infinity`, return *+&infin;*.
1. If _mv_ is -10<sup>10000</sup> and _str_ contains `Infinity`, return *-&infin;*.
Expand Down