Skip to content

Editorial: Fix ecmarkup warnings#645

Merged
gibson042 merged 5 commits intotc39:masterfrom
gibson042:2022-01-fix-ecmarkup-warnings
Jan 19, 2022
Merged

Editorial: Fix ecmarkup warnings#645
gibson042 merged 5 commits intotc39:masterfrom
gibson042:2022-01-fix-ecmarkup-warnings

Conversation

@gibson042
Copy link
Member

warning: trailing spaces are not allowed (spelling) at spec/datetimeformat.html:152:54:
  150 |           1. Assert: _hour12_ is *undefined*.
  151 |         1. Set _dateTimeFormat_.[[HourCycle]] to _hc_.
> 152 |         1. Set _formatOptions_.[[hourCycle]] to _hc_. 
      |                                                      ^
  153 |         1. Let _matcher_ be ? GetOption(_options_, *"formatMatcher"*, *"string"*, « *"basic"*, *"best fit"* », *"best fit"*).
  154 |         1. Let _dateStyle_ be ? GetOption(_options_, *"dateStyle"*, *"string"*, « *"full"*, *"long"*, *"medium"*, *"short"* », *undefined*).
  155 |         1. Set _dateTimeFormat_.[[DateStyle]] to _dateStyle_.


warning: literal Number or BigInt values should be followed by <sub>𝔽</sub> or <sub>ℤ</sub> respectively (spelling) at spec/numberformat.html:196:27:
  194 |         1. If _x_ is *NaN*, then
  195 |           1. Let _n_ be an implementation- and locale-dependent (ILD) String value indicating the *NaN* value.
> 196 |         1. Else if _x_ is *+&infin;*, then
      |                           ^
  197 |           1. Let _n_ be an ILD String value indicating positive infinity.
  198 |         1. Else if _x_ is *-&infin;*, then
  199 |           1. Let _n_ be an ILD String value indicating negative infinity.


warning: literal Number or BigInt values should be followed by <sub>𝔽</sub> or <sub>ℤ</sub> respectively (spelling) at spec/numberformat.html:198:27:
  196 |         1. Else if _x_ is *+&infin;*, then
  197 |           1. Let _n_ be an ILD String value indicating positive infinity.
> 198 |         1. Else if _x_ is *-&infin;*, then
      |                           ^
  199 |           1. Let _n_ be an ILD String value indicating negative infinity.
  200 |         1. Else,
  201 |           1. If _numberFormat_.[[Style]] is *"percent"*, let _x_ be 100 × _x_.

@gibson042 gibson042 requested review from ryzokuken and sffc January 13, 2022 20:06
1. Let _exponent_ be ComputeExponent(_numberFormat_, _x_).
1. Let _x_ be _x_ × 10<sup>-_exponent_</sup>.
1. Set _x_ to _x_ × 10<sup>-_exponent_</sup>.
1. Let _formatNumberResult_ be FormatNumericToString(_numberFormat_, _x_).
Copy link
Member Author

Choose a reason for hiding this comment

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

@sffc There is an unrelated problem here: FormatNumericToString expects a Number or BigInt value, while x is a mathematical value that AFAICT might suffer output-affecting lossiness if converted.

And similar problems in later steps (in which whether or not x is a mathematical value is dependent upon whether or not the original input was finite!):

  1. GetNumberFormatPattern performs incoherent comparisons on its input, _x_ is 0 or _x_ &gt; 0 is only valid for mathematical _x_ while _x_ is *NaN* can only be true if _x_ is a Number.
  2. Likewise, PartitionNotationSubPattern seems to expect a mathematical x but then compares it to infinities and *NaN*.

I think the best fix would be updating FormatNumericToString/GetNumberFormatPattern/PartitionNotationSubPattern/etc. to accept new parameters allowing them to identify special non-mathematical Number values such as negative zero and infinities and NaN.

Copy link
Contributor

@sffc sffc left a comment

Choose a reason for hiding this comment

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

LGTM and after this is merged I'll need to merge these changes into NFv3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants