Skip to content

Commit

Permalink
fixup: [spec] npm run build
Browse files Browse the repository at this point in the history
  • Loading branch information
jessealama committed May 30, 2024
1 parent 8e635e0 commit 0494710
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3408,6 +3408,9 @@ <h1><span class="secnum">2.2</span> The Decimal128 Constructor</h1>
<emu-clause id="sec-the-decimal128-constructor-value">
<h1><span class="secnum">2.2.1</span> Decimal128 ( <var>x</var> )</h1>
<emu-alg><ol><li>If NewTarget is <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>toParse</var> be <emu-val>undefined</emu-val>.</li><li>If <var>x</var> <emu-xref href="#sec-ecmascript-language-types-bigint-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-bigint-type">is a BigInt</a></emu-xref>, set <var>toParse</var> to <emu-xref aoid="BigInt::toString"><a href="https://tc39.es/ecma262/#sec-numeric-types-bigint-tostring">BigInt::toString</a></emu-xref>(<var>x</var>, 10).</li><li>Otherwise, if <var>x</var> <emu-xref href="#sec-ecmascript-language-types-number-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>, set <var>toParse</var> to <emu-xref aoid="Number::toString"><a href="https://tc39.es/ecma262/#sec-numeric-types-number-tostring">Number::toString</a></emu-xref>(<var>x</var>, 10).</li><li>Otherwise, if <var>x</var> <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, set <var>toParse</var> to <var>x</var>.</li><li>If <var>toParse</var> <emu-xref href="#sec-ecmascript-language-types-string-type"><a href="https://tc39.es/ecma262/#sec-ecmascript-language-types-string-type">is not a String</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor"><a href="https://tc39.es/ecma262/#sec-ordinarycreatefromconstructor">OrdinaryCreateFromConstructor</a></emu-xref>(NewTarget, <emu-val>"%Decimal128.prototype%"</emu-val>, « <var class="field">[[Decimal128Data]]</var>&nbsp;»).</li><li>If <var>toParse</var> is <emu-val>"NaN"</emu-val>, regardless of case, set <var>O</var>.<var class="field">[[Decimal128Data]]</var> to <emu-val>NaN</emu-val><sub>𝔻</sub>.</li><li>If <var>toParse</var> is <emu-val>"-Infinity"</emu-val>, regardless of case, set <var>O</var>.<var class="field">[[Decimal128Data]]</var> to <emu-val>-∞</emu-val><sub>𝔻</sub>.</li><li>If <var>toParse</var> is <emu-val>"Infinity"</emu-val>, regardless of case, set <var>O</var>.<var class="field">[[Decimal128Data]]</var> to <emu-val>+∞</emu-val><sub>𝔻</sub>.</li><li>Let <var>parseResult</var> be <emu-xref aoid="ParseText"><a href="https://tc39.es/ecma262/#sec-parsetext">ParseText</a></emu-xref>(<var>toParse</var>, <emu-nt><a href="https://tc39.es/ecma262/#prod-DecimalLiteral">DecimalLiteral</a></emu-nt>).</li><li>If <var>parseResult</var> is a <emu-xref href="#sec-list-and-record-specification-type"><a href="https://tc39.es/ecma262/#sec-list-and-record-specification-type">List</a></emu-xref> of errors, throw a <emu-val>SyntaxError</emu-val> exception.</li><li>If <var>parseResult</var> contains a <emu-nt><a href="https://tc39.es/ecma262/#prod-DecimalIntegerLiteral">DecimalIntegerLiteral</a></emu-nt>, then<ol><li>Let <var>integerPart</var> be the source text contained within the <emu-nt><a href="https://tc39.es/ecma262/#prod-DecimalIntegerLiteral">DecimalIntegerLiteral</a></emu-nt> <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li></ol></li><li>Else,<ol><li>Let <var>integerPart</var> be <emu-val>"0"</emu-val>.</li></ol></li><li>Let <var>nonIntegerDigits</var> be the source text contained within the <emu-nt><a href="https://tc39.es/ecma262/#prod-DecimalLiteral">DecimalLiteral</a></emu-nt> <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li><li>If <var>parseResult</var> contains a <emu-nt><a href="https://tc39.es/ecma262/#prod-ExponentPart">ExponentPart</a></emu-nt> <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref> whose source text is not <emu-val>""</emu-val>, then<ol><li>Let <var>exponentPart</var> be the source text contained within the <emu-nt><a href="https://tc39.es/ecma262/#prod-ExponentPart">ExponentPart</a></emu-nt> <emu-xref href="#sec-syntactic-grammar"><a href="https://tc39.es/ecma262/#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li><li>Let <var>s</var> be the concatenation of <var>integerPart</var> and <var>nonIntegerDigits</var>.</li><li>Let <var>m</var> be the <emu-xref href="#dfn-decimal128-mathematical-value" id="_ref_55"><a href="#dfn-decimal128-mathematical-value">mathematical value</a></emu-xref> whose decimal representation is <var>s</var>.</li><li>Let <var>e</var> be the <emu-xref href="#dfn-decimal128-mathematical-value" id="_ref_56"><a href="#dfn-decimal128-mathematical-value">mathematical value</a></emu-xref> whose decimal representatin is <var>exponentPart</var>.</li><li>Set <var>O</var>.<var class="field">[[Decimal128Data]]</var> to ?&nbsp;<emu-xref aoid="EnsureDecimal128Value" id="_ref_57"><a href="#sec-decimal128-d">EnsureDecimal128Value</a></emu-xref>(<var>m</var>, <var>e</var>, <emu-val>"halfEven"</emu-val>).</li></ol></li><li>Else,<ol><li>Let <var>s</var> be the concatenation of <var>integerPart</var> and <var>nonIntegerDigits</var>.</li><li>Let <var>q</var> be the length of <var>nonIntegerDigits</var>.</li><li>Let <var>m</var> be the <emu-xref href="#dfn-decimal128-mathematical-value" id="_ref_58"><a href="#dfn-decimal128-mathematical-value">mathematical value</a></emu-xref> whose decimal representation is <var>s</var>.</li><li>Set <var>O</var>.<var class="field">[[Decimal128Data]]</var> to ?&nbsp;<emu-xref aoid="EnsureDecimal128Value" id="_ref_59"><a href="#sec-decimal128-d">EnsureDecimal128Value</a></emu-xref>(<var>m</var>, -<var>q</var>, <emu-val>"halfEven"</emu-val>).</li></ol></li><li>Return <var>O</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Given a Number argument, the <emu-xref href="#constructor"><a href="https://tc39.es/ecma262/#constructor">constructor</a></emu-xref> converts it to a String using the <emu-xref href="#sec-number.prototype.tostring"><a href="https://tc39.es/ecma262/#sec-number.prototype.tostring">toString</a></emu-xref> method (with no arguments). In some cases, this may not be desited. In some use cases, given a Number, one may wish to call the Decimal128 <emu-xref href="#constructor"><a href="https://tc39.es/ecma262/#constructor">constructor</a></emu-xref> not with the number but rather with, for instance, the result of calling <emu-xref href="#sec-number.prototype.tofixed"><a href="https://tc39.es/ecma262/#sec-number.prototype.tofixed">toFixed</a></emu-xref> or <emu-xref href="#sec-number.prototype.toprecision"><a href="https://tc39.es/ecma262/#sec-number.prototype.toprecision">toPrecision</a></emu-xref> on the Number, thereby ensuring a certain level of precision that may get lost when using Number’s toString.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
</emu-clause>
Expand Down

0 comments on commit 0494710

Please sign in to comment.