One of the tests was failing with a message: 1.1% formatted as 2%.

Looking at the algorithm for 11.1.1.1
InitializeNumberFormat (numberFormat, locales, options), steps 25 - 29 I
think the test shouldn't fail.

25. If s is "currency" then let mnfdDefault be cDigits; else let *mnfdDefault
be 0*. // 0
26. Let *mnfd* be the result of calling the GetNumberOption abstract
operation with arguments options,
"minimumFractionDigits", 0, 20, and *mnfdDefault*. // 0
27. Set the [[*minimumFractionDigits*]] internal property of numberFormat
to *mnfd*. // Still 0.
28. If s is "currency" then let mxfdDefault be max(mnfd, cDigits); else if
s is "percent" then let mxfdDefault be
max(mnfd, 0); else let mxfdDefault be max(mnfd, 3). // 0 in case of percent.
29. Let mxfd be the result of calling the GetNumberOption abstract
operation with arguments options,
"maximumFractionDigits", mnfd, 20, and mxfdDefault. // And 0 for percent
again.

So both [[minimumFractionDigits]] and [[maximumFractionDigits]] are 0 in
case of "percent" formatting (except if user overrides it with
corresponding options parameter).

1.1 should be (can't find it in the spec right now) rounded up, so it ends
up as 2.

In order to pass the test I internally (ICU code) incremented number of
fractional digits from 2 to 3 - 0.011 then formats as 1.1%. We should
probably change defaults depending on what people expect with percent
formatting.

Did I miss something?

-- 
Nebojša Ćirić
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to