profile
viewpoint
If you are wondering where the data of this site comes from, please visit https://api.github.com/users/rwaldron/events. GitMemory does not store any data, but only uses NGINX to cache data for a period of time. The idea behind GitMemory is simply to give users a better reading experience.
Rick Waldron rwaldron Boston, MA He/him.

meltingice/CamanJS 3404

Javascript HTML5 (Ca)nvas (Man)ipulation

firmata/firmata.js 663

JavaScript implementation of the Firmata protocol

nebrius/raspi-io 523

An IO plugin for Johnny-Five that provides support for the Raspberry Pi

JSFoundation/standards 246

Giving web developers a voice in the standards process

bterlson/eshost-cli 173

Run ECMAScript code uniformly across any ECMAScript host

bterlson/eshost 113

A uniform wrapper around a multitude of ECMAScript hosts. CLI: https://github.com/bterlson/eshost-cli

gf3/WAT 102

LOLWAT?

jeresig/dromaeo 76

JavaScript Performance Test Suite

bterlson/test262-harness 59

Experimental harness for test262

boazsender/jQuery-Twitter-Plugin 57

A jQuery plugin for putting twitter searches on websites.

startedjpuri/defi_yield_farming

started time in 9 minutes

issue commentjquery/jquery

on input event goes automatically after comming back to page

i have been working hard on studying xss-injection and how to best manipulate functions and more, if you can give me good repos to look into i would be grateful. ive been following you guys on here and your absolutely brilliant :) question tho, when checking sites for vulnerabilities and bugs, do you always update the findings here?

qadenza

comment created time in 32 minutes

pull request commenttc39/ecma262

Replace each abstract op's preamble with a structured 'header'.

I've left the tags on successive lines (for ease of later insertion).

That's fine too.

jmdyck

comment created time in an hour

pull request commenttc39/ecma262

Replace each abstract op's preamble with a structured 'header'.

The last remaining change I'd like to see is to drop the returns and also has access to sections.

Done.

  • The returns sections as currently structured don't really make sense in a world where not all AOs return completion records,

I disagree: I do my static type analysis in such a world, so they make enough sense for that. But we can discuss that in 1796 or in chat.

  • SortCompare ... we could put the It also has access to the <var>comparefn</var> argument passed to the current invocation of the <code>sort</code> method. in the description without needing to support a new kind of header.

Done.

Plus there's some interest in removing these implicit parameters as well.

Yup, but not a lot of action.

This will leave many headers empty. I'm OK with that - they can be present as <dl class='header'></dl>, awaiting later use.

Do you specifically want them on one line like that? I've left the tags on successive lines (for ease of later insertion).

jmdyck

comment created time in 4 hours

startedrwaldron/idiomatic.js

started time in 5 hours

push eventtc39/dataset

github-actions[bot]

commit sha 699ad06bc0c8aceb3e27bcf313184d851bf45ccb

deploy: f6ad2bb19b6e75214377eae636c477d02837b13c

view details

push time in 7 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).+          </emu-alg>+          <emu-grammar>+            StrDecimalLiteral ::: StrUnsignedDecimalLiteral+            StrDecimalLiteral ::: `+` StrUnsignedDecimalLiteral+          </emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrUnsignedDecimalLiteral|.+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be StringNumericValue of |StrUnsignedDecimalLiteral|.+            1. If _a_ is *+0*<sub>๐”ฝ</sub>, return *-0*<sub>๐”ฝ</sub>.+            1. Return -_a_.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. For the purposes of this abstract operation, "the mathematical value denoted by" a representation of a mathematical value is the inverse of "the decimal representation of" a mathematical value. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits, return ๐”ฝ(_n_).

Oh, something else: In the current spec, "the decimal representation of x" is only applied to integers (and only positive integers, I think), whereas this applies it to non-integers (and negatives, and zero). I don't think this creates any definitional problems, but I thought it shouldn't go un-noted.

michaelficarra

comment created time in 8 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>          <emu-clause id="sec-runtime-semantics-mv-s">           <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. Additional definitions for MV are provided in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>+          <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return ๐”ฝ(MV of |StrNumericLiteral|).+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |StrUnsignedDecimalLiteral|.+            1. If _a_ is 0, return *-0*<sub>๐”ฝ</sub>.+            1. Return RoundStringMVResult(-1 &times; _a_).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits in its decimal representation, return ๐”ฝ(_n_).+            1. Let _option1_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit.+            1. Let _option2_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit and then incrementing it at the 20th position (with carrying as necessary).

Okay, thanks.

michaelficarra

comment created time in 8 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>          <emu-clause id="sec-runtime-semantics-mv-s">           <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. Additional definitions for MV are provided in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>+          <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return ๐”ฝ(MV of |StrNumericLiteral|).+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |StrUnsignedDecimalLiteral|.+            1. If _a_ is 0, return *-0*<sub>๐”ฝ</sub>.+            1. Return RoundStringMVResult(-1 &times; _a_).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits in its decimal representation, return ๐”ฝ(_n_).+            1. Let _option1_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit.+            1. Let _option2_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit and then incrementing it at the 20th position (with carrying as necessary).

I think it's reasonable to assume that readers understand how to derive a mathematical value from its decimal representation, as is done in this PR, but since MV (the "elsewhere") is working with parse nodes - which are not normally imbued with mathematical values as a matter of background knowledge, unlike decimal representations - it warrants a more explicit definition there. (Besides which, MV has a number of other cases it needs to define explicitly anyway, so it might as well be explicit in this case.)

That is to say: the operation "take the mathematical value denoted by this decimal representation" is a reasonable thing to assume readers are familiar with. The operation "take the mathematical value denoted by this parse node" is less so, even when the parse node happens to represent a string which is the decimal representation of a number, since the parse nodes are an artifact defined by this specification.

So I don't really regard this as an inconsistency. At any rate, I'm fine with it.

michaelficarra

comment created time in 9 hours

pull request commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

(Hm, that's weird. I meant to submit a reply and a review separately, but GitHub seems to have merged them. I think it still makes sense.)

michaelficarra

comment created time in 9 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>          <emu-clause id="sec-runtime-semantics-mv-s">           <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. Additional definitions for MV are provided in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>+          <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return ๐”ฝ(MV of |StrNumericLiteral|).+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |StrUnsignedDecimalLiteral|.+            1. If _a_ is 0, return *-0*<sub>๐”ฝ</sub>.+            1. Return RoundStringMVResult(-1 &times; _a_).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).

If the editors prefer the superscript without spaces, there are about 18 other superscripts with spaces that you might wish to convert.

michaelficarra

comment created time in 10 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).+          </emu-alg>+          <emu-grammar>+            StrDecimalLiteral ::: StrUnsignedDecimalLiteral+            StrDecimalLiteral ::: `+` StrUnsignedDecimalLiteral+          </emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrUnsignedDecimalLiteral|.+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be StringNumericValue of |StrUnsignedDecimalLiteral|.+            1. If _a_ is *+0*<sub>๐”ฝ</sub>, return *-0*<sub>๐”ฝ</sub>.+            1. Return -_a_.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. For the purposes of this abstract operation, "the mathematical value denoted by" a representation of a mathematical value is the inverse of "the decimal representation of" a mathematical value. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits, return ๐”ฝ(_n_).+            1. Let _option1_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit.+            1. Let _option2_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit and then incrementing it at the 20th position (with carrying as necessary).+            1. Let _chosen_ be an implementation-defined choice of either _option1_ or _option2_.+            1. Return ๐”ฝ(_chosen_).+          </emu-alg>

Before the call to RoundStringMVResult, we convert a decimal representation to a mathematical value, and then inside the call, we convert that to a decimal representation, tweak that, then convert that to a mathematical value, and convert that to a Number. So it's:

  • decimal rep -> math value -> decimal rep -> math value -> Number

I'm not saying it's wrong, it just seems circuitous.

michaelficarra

comment created time in 9 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>          <emu-clause id="sec-runtime-semantics-mv-s">           <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. Additional definitions for MV are provided in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>+          <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return ๐”ฝ(MV of |StrNumericLiteral|).+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |StrUnsignedDecimalLiteral|.+            1. If _a_ is 0, return *-0*<sub>๐”ฝ</sub>.+            1. Return RoundStringMVResult(-1 &times; _a_).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits in its decimal representation, return ๐”ฝ(_n_).+            1. Let _option1_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit.+            1. Let _option2_ be the mathematical value denoted by the result of replacing each significant digit in the decimal representation of _n_ after the 20th with a 0 digit and then incrementing it at the 20th position (with carrying as necessary).

Is the fact that the name MV is composed of the first two letters of "mathematical" and "value" causing you to think that it is being used as an initialism for "mathematical value" instead of to refer to the AO with that name?

Nope.

Do you agree with me that the AO named MV and the prose "the mathematical value of" are not related in any way?

Sure:

  • MV is an AO that maps literals to mathematical values.
  • "the mathematical value of" is a special phrase that 'converts' Numbers and BigInts to mathematical values.

And neither is defined in terms of the other.

However, what I'm talking about here is the new phrase "the mathematical value denoted by", which maps 'representations' to mathematical values, and thus is similar to (some of) what MV currently does. I'm saying it's odd that RoundStringMVResult can just say "the mathematical value denoted by x" when elsewhere we explicitly do the arithmetic to accomplish the same result. It's an inconsistency in what the spec assumes as its 'base level'.

We talked about this a bit in the editor call today. @jmdyck does the most recent commit address your concerns?

(This adds a sentence to RoundStringMVResult defining the new phrase.) That's an improvement, I guess, but no, I don't think it addresses the point I raised.

  • One way to address it would be, as in the current spec, to use MV (rather than the new phrase) to get the mathematical values of the two 20-digit options. (Though that's somewhat complicated by RoundStringMVResult working with decimal representations rather than literals.)

  • Another way would be to keep the new phrase and use it elsewhere instead of explicit arithmetic. (Though I don't know how well that would work out.)

But if the editors understand my point and are okay with the inconsistency, well, it's not like it'd be the only one in the spec.

michaelficarra

comment created time in 9 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h1>Static Semantics: MV</h1>         <h1>Static Semantics: NumericValue</h1>         <emu-grammar>NumericLiteral :: DecimalLiteral</emu-grammar>         <emu-alg>-          1. Return the Number value that results from rounding the MV of |DecimalLiteral| as described below.+          1. Return RoundStringMVResult(MV of |DecimalLiteral|).         </emu-alg>         <emu-grammar>NumericLiteral :: NonDecimalIntegerLiteral</emu-grammar>         <emu-alg>-          1. Return the Number value that results from rounding the MV of |NonDecimalIntegerLiteral| as described below.+          1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).
          1. Return ๐”ฝ(MV of |NonDecimalIntegerLiteral|).

As above, 20-digit rounding doesn't apply to non-decimal literals.

michaelficarra

comment created time in 9 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">
        <emu-clause id="sec-runtime-semantics-stringnumericvalue" type="sdo" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">
michaelficarra

comment created time in 10 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).+          </emu-alg>+          <emu-grammar>+            StrDecimalLiteral ::: StrUnsignedDecimalLiteral+            StrDecimalLiteral ::: `+` StrUnsignedDecimalLiteral

The two productions should be separated by an empty line.

Alternatively, you could drop this grammar+alg pair and let the chain rule handle it.

michaelficarra

comment created time in 10 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).+          </emu-alg>+          <emu-grammar>+            StrDecimalLiteral ::: StrUnsignedDecimalLiteral+            StrDecimalLiteral ::: `+` StrUnsignedDecimalLiteral+          </emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrUnsignedDecimalLiteral|.+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be StringNumericValue of |StrUnsignedDecimalLiteral|.+            1. If _a_ is *+0*<sub>๐”ฝ</sub>, return *-0*<sub>๐”ฝ</sub>.+            1. Return -_a_.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>

Since this operation is also used for NumericLiterals, where there isn't a String involved, you might want to remove "String" from the name.

michaelficarra

comment created time in 10 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).
            1. Return ๐”ฝ(MV of |NonDecimalIntegerLiteral|).

In the current spec, the 20-digit rounding only applies to decimal literals. If you apply it to non-decimal literals, then there are cases where the spec would allow two valid outcomes where it currently only allows one, which would be a normative change.

michaelficarra

comment created time in 9 hours

Pull request review commenttc39/ecma262

Editorial: extract StringNumericValue from MV and add/use RoundStringMVResult helper

 <h2>Syntax</h2>           </ul>         </emu-note> -        <emu-clause id="sec-runtime-semantics-mv-s">-          <h1>Runtime Semantics: MV</h1>-          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here. This value is determined in two steps: first, a mathematical value (MV) is derived from the String numeric literal; second, this mathematical value is rounded as described below. The MV on any grammar symbol, not provided below, is the MV for that symbol defined in <emu-xref href="#sec-static-semantics-mv"></emu-xref>.</p>-          <ul>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: [empty]</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace</emu-grammar> is 0.-            </li>-            <li>-              The MV of <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar> is the MV of |StrNumericLiteral|, no matter whether white space is present or not.-            </li>-            <li>-              The MV of <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar> is the negative of the MV of |StrUnsignedDecimalLiteral|. (Note that if the MV of |StrUnsignedDecimalLiteral| is 0, the negative of this MV is also 0. The rounding rule described below handles the conversion of this signless mathematical zero to a floating-point *+0*<sub>๐”ฝ</sub> or *-0*<sub>๐”ฝ</sub> as appropriate.)-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar> is 10<sup>10000</sup> (a value so large that it will round to *+&infin;*<sub>๐”ฝ</sub>).-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits</emu-grammar> is the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>), where _n_ is the number of code points in the second |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits ExponentPart</emu-grammar> is (the MV of the first |DecimalDigits| plus (the MV of the second |DecimalDigits| times 10<sup>-_n_</sup>)) times 10<sup>_e_</sup>, where _n_ is the number of code points in the second |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits</emu-grammar> is the MV of |DecimalDigits| times 10<sup>-_n_</sup>, where _n_ is the number of code points in |DecimalDigits|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_ - _n_</sup>, where _n_ is the number of code points in |DecimalDigits| and _e_ is the MV of |ExponentPart|.-            </li>-            <li>-              The MV of <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart</emu-grammar> is the MV of |DecimalDigits| times 10<sup>_e_</sup>, where _e_ is the MV of |ExponentPart|.-            </li>-          </ul>-          <p>Once the exact MV for a String numeric literal has been determined, it is then rounded to a value of the Number type. If the MV is 0, then the rounded value is *+0*<sub>๐”ฝ</sub> unless the first non white space code point in the String numeric literal is `-`, in which case the rounded value is *-0*<sub>๐”ฝ</sub>. Otherwise, the rounded value must be the Number value for the MV (in the sense defined in <emu-xref href="#sec-ecmascript-language-types-number-type"></emu-xref>), unless the literal includes a |StrUnsignedDecimalLiteral| and the literal has more than 20 significant digits, in which case the Number value may be either the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit or the Number value for the MV of a literal produced by replacing each significant digit after the 20th with a 0 digit and then incrementing the literal at the 20th digit position. A digit is significant if it is not part of an |ExponentPart| and</p>-          <ul>-            <li>-              it is not `0`; or-            </li>-            <li>-              there is a non-zero digit to its left and there is a non-zero digit, not in the |ExponentPart|, to its right.-            </li>-          </ul>+        <emu-clause id="sec-runtime-semantics-stringnumericvalue" aoid="StringNumericValue" oldids="sec-runtime-semantics-mv-s">+          <h1>Runtime Semantics: StringNumericValue</h1>+          <p>The conversion of a String to a Number value is similar overall to the determination of the Number value for a numeric literal (see <emu-xref href="#sec-literals-numeric-literals"></emu-xref>), but some of the details are different, so the process for converting a String numeric literal to a value of Number type is given here.</p>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return *+0*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StringNumericLiteral ::: StrWhiteSpace? StrNumericLiteral StrWhiteSpace?</emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrNumericLiteral|.+          </emu-alg>+          <emu-grammar>StrNumericLiteral ::: NonDecimalIntegerLiteral</emu-grammar>+          <emu-alg>+            1. Return RoundStringMVResult(MV of |NonDecimalIntegerLiteral|).+          </emu-alg>+          <emu-grammar>+            StrDecimalLiteral ::: StrUnsignedDecimalLiteral+            StrDecimalLiteral ::: `+` StrUnsignedDecimalLiteral+          </emu-grammar>+          <emu-alg>+            1. Return StringNumericValue of |StrUnsignedDecimalLiteral|.+          </emu-alg>+          <emu-grammar>StrDecimalLiteral ::: `-` StrUnsignedDecimalLiteral</emu-grammar>+          <emu-alg>+            1. Let _a_ be StringNumericValue of |StrUnsignedDecimalLiteral|.+            1. If _a_ is *+0*<sub>๐”ฝ</sub>, return *-0*<sub>๐”ฝ</sub>.+            1. Return -_a_.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `Infinity`</emu-grammar>+          <emu-alg>+            1. Return *+&infin;*<sub>๐”ฝ</sub>.+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits `.` DecimalDigits? ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of the first |DecimalDigits|.+            1. If the second |DecimalDigits| is present, let _b_ be MV of the second |DecimalDigits|. Otherwise, let _b_ be 0.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in the second |DecimalDigits|.+            1. Return RoundStringMVResult((_a_ + (_b_ &times; 10<sup>-_n_</sup>)) &times; 10<sup>_e_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: `.` DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Let _n_ be the number of code points in |DecimalDigits|.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_-_n_</sup>).+          </emu-alg>+          <emu-grammar>StrUnsignedDecimalLiteral ::: DecimalDigits ExponentPart?</emu-grammar>+          <emu-alg>+            1. Let _a_ be MV of |DecimalDigits|.+            1. If |ExponentPart| is present, let _e_ be MV of |ExponentPart|. Otherwise, let _e_ be 0.+            1. Return RoundStringMVResult(_a_ &times; 10<sup>_e_</sup>).+          </emu-alg>+        </emu-clause>++        <emu-clause id="sec-roundstringmvresult" aoid="RoundStringMVResult">+          <h1>RoundStringMVResult ( _n_ )</h1>+          <p>The abstract operation RoundStringMVResult takes argument _n_ (a mathematical value). It converts _n_ to a Number in an implementation-defined manner. For the purposes of this abstract operation, a digit is significant if it is not zero or there is a non-zero digit to its left and there is a non-zero digit to its right. For the purposes of this abstract operation, "the mathematical value denoted by" a representation of a mathematical value is the inverse of "the decimal representation of" a mathematical value. It performs the following steps when called:</p>+          <emu-alg>+            1. If the decimal representation of _n_ has fewer than 20 significant digits, return ๐”ฝ(_n_).
            1. If the decimal representation of _n_ has 20 or fewer significant digits, return ๐”ฝ(_n_).

(or "fewer than 21", I suppose.) As is, if the decimal rep has exactly 20 sig digits, then option2 increments the 20th position, which is not currently allowed.

michaelficarra

comment created time in 9 hours

startedmikewest/credentiallessness

started time in 11 hours

created repositoryjpuri/defi_yield_farming

DEFI yield farming dapp using chainlink price feeds

created time in 12 hours

startedjpuri/Solidity-Examples

started time in 13 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

Got it!

Didn't read down far enough.

robertsLando

comment created time in 13 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

If you read the linked issue it didn't work. We just landed another pr that should. It will go out with the next version.

robertsLando

comment created time in 13 hours

issue commentserialport/node-serialport

segfault after updating from 9.0.7 -> 9.1.0

Hi,

I may be missing something, but wasn't 9.2.0 meant to alter the versioning to be exact?

package.json reads (I have installed serialport 9.2.0)

@serialport/bindings": "^9.2.0",

Everything else is fixed.

robertsLando

comment created time in 13 hours

fork rafiquecudjoe/idiomatic.js

Principles of Writing Consistent, Idiomatic JavaScript

fork in 13 hours

issue commentserialport/node-serialport

Enhancement: change version interdependencies

Good find!

GazHank

comment created time in 13 hours

push eventserialport/node-serialport

Gareth Hancock

commit sha ba4e4e8327acaedc6a6bfaf83f335ec5d2a47061

Lerna changed to use exact version dependencies (#2276)

view details

push time in 13 hours

PR merged serialport/node-serialport

Lerna changed to use exact version dependencies

Change dependencies of the serialport package to use exact versions. e.g. serialport 9.0.0 would have a dependency on "@serialport/bindings": "9.0.0" instead of "@serialport/bindings": "^9.0.0"

Config Lerna to publish exact version dependencies per https://github.com/serialport/node-serialport/issues/2270

+1 -1

0 comment

1 changed file

GazHank

pr closed time in 13 hours

PR opened serialport/node-serialport

Lerna changed to use exact version dependencies

Change dependencies of the serialport package to use exact versions. e.g. serialport 9.0.0 would have a dependency on "@serialport/bindings": "9.0.0" instead of "@serialport/bindings": "^9.0.0"

Config Lerna to publish exact version dependencies per https://github.com/serialport/node-serialport/issues/2270

+1 -1

0 comment

1 changed file

pr created time in 14 hours