You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Editorial: Inline the PluralRules GetOperands AO (#930)
GetOperands was only called from the ResolvePlural AO, which immediately passed
the returned Record into the implementation-defined PluralRuleSelect AO.
The revised version directly passes PluralRuleSelect the decimal String which
was previously parsed by GetOperands.
Implementations of PluralRuleSelect may (or may not) internally use something
like GetOperands to determine the plural category returned.
fixes#635
<dd>It extracts numeric features from _s_ that correspond with the operands of <ahref="https://unicode.org/reports/tr35/tr35-numbers.html#Operands">Unicode Technical Standard #35 Part 3 Numbers, Section 5.1.1 Operands</a>.</dd>
293
-
</dl>
294
-
<emu-alg>
295
-
1. Let _n_ be ! ToNumber(_s_).
296
-
1.Assert:_n_ is finite.
297
-
1. Let _dp_ be StringIndexOf(_s_, *"."*, 0).
298
-
1. If _dp_ is ~not-found~, then
299
-
1. Let _intPart_ be _n_.
300
-
1. Let _fracSlice_ be *""*.
301
-
1. Else,
302
-
1. Let _intPart_ be the substring of _s_ from 0 to _dp_.
303
-
1. Let _fracSlice_ be the substring of _s_ from _dp_ + 1.
304
-
1. Let _i_ be abs(! ToNumber(_intPart_)).
305
-
1. Let _fracDigitCount_ be the length of _fracSlice_.
306
-
1. Let _f_ be ! ToNumber(_fracSlice_).
307
-
1. Let _significantFracSlice_ be the value of _fracSlice_ stripped of trailing *"0"*.
308
-
1. Let _significantFracDigitCount_ be the length of _significantFracSlice_.
309
-
1. Let _significantFrac_ be ! ToNumber(_significantFracSlice_).
310
-
1. Return a new Plural Rules Operands Record { [[Number]]: abs(_n_), [[IntegerDigits]]: _i_, [[FractionDigits]]: _f_, [[NumberOfFractionDigits]]: _fracDigitCount_, [[FractionDigitsWithoutTrailing]]: _significantFrac_, [[NumberOfFractionDigitsWithoutTrailing]]: _significantFracDigitCount_ }.
Each <dfnid="plural-operands-record">Plural Rules Operands Record</dfn> has the fields defined in <emu-xrefhref="#table-plural-operands"></emu-xref>.
319
-
</p>
320
-
321
-
<emu-tableid="table-plural-operands">
322
-
<emu-caption>Plural Rules Operands Record Fields</emu-caption>
323
-
<tableclass="real-table">
324
-
<thead>
325
-
<tr>
326
-
<th>Field Name</th>
327
-
<th>Value Type</th>
328
-
<th>UTS #35 Operand</th>
329
-
<th>Description</th>
330
-
</tr>
331
-
</thead>
332
-
<tr>
333
-
<td>[[Number]]</td>
334
-
<td>Number</td>
335
-
<td>n</td>
336
-
<td>Absolute value of the source number</td>
337
-
</tr>
338
-
<tr>
339
-
<td>[[IntegerDigits]]</td>
340
-
<td>Number</td>
341
-
<td>i</td>
342
-
<td>Integer part of [[Number]].</td>
343
-
</tr>
344
-
<tr>
345
-
<td>[[FractionDigits]]</td>
346
-
<td>Number</td>
347
-
<td>f</td>
348
-
<td>Visible fraction digits in [[Number]], <em>with</em> trailing zeroes, as an integer having [[NumberOfFractionDigits]] digits.</td>
349
-
</tr>
350
-
<tr>
351
-
<td>[[NumberOfFractionDigits]]</td>
352
-
<td>Number</td>
353
-
<td>v</td>
354
-
<td>Number of visible fraction digits in [[Number]], <em>with</em> trailing zeroes.</td>
355
-
</tr>
356
-
<tr>
357
-
<td>[[FractionDigitsWithoutTrailing]]</td>
358
-
<td>Number</td>
359
-
<td>t</td>
360
-
<td>Visible fraction digits in [[Number]], <em>without</em> trailing zeroes, as an integer having [[NumberOfFractionDigitsWithoutTrailing]] digits.</td>
0 commit comments