tc39 / test262

Official ECMAScript Conformance Test Suite
Other
2.32k stars 459 forks source link

nanoseconds: Number.MAX_VALUE in precision-exact-mathematical-values #4059

Closed FrankYFTang closed 5 months ago

FrankYFTang commented 5 months ago

@anba @ryzokuken @ben-allen @sffc

I have a problem with the test case of

  // ~1.7976931348623157e+308 / 10^9
  // = ~1.7976931348623157 × 10^299
  {
    seconds: 0,
    milliseconds: 0,
    microseconds: 0,
    nanoseconds: Number.MAX_VALUE,
  },

f What is the expected output in this test? It is not clear what you intend to test here.

ptomato commented 5 months ago

Can you give a link to the test file where this occurs?

FrankYFTang commented 5 months ago

sorry https://github.com/tc39/test262/blob/79e9b39f3a576154b1bc39f9dbd95d25addc4ebf/test/intl402/DurationFormat/prototype/format/precision-exact-mathematical-values.js#L74

anba commented 5 months ago

Intl.DurationFormat uses mathematical values, which means Number.MAX_VALUE mustn't be formatted by Intl.DurationFormat as a IEEE-754 double value, but instead its exact value must be used. IOW, the output must resemble the output of Intl.NumberFormat("en").format(BigInt(Number.MAX_VALUE)) and not the output of Intl.NumberFormat("en").format(Number.MAX_VALUE).

Related: Updates for https://github.com/tc39/proposal-intl-duration-format/pull/173 are in #3988.

FrankYFTang commented 5 months ago

ok, that make sense.