Commit 0559fd70 authored by vabr's avatar vabr Committed by Commit bot

NumberFormat: default mnsd value is 1

CreateNumberFormat of src/js/i18n.js implements
http://www.ecma-international.org/ecma-402/1.0/#sec-11.1.1.1, but has a typo
in step 33a. The spec says that the default value for minimumSignificantDigits
should be 1, while the script set it to 0.

This CL fixes that typo and adds a test for that.

BUG=v8:5554

Review-Url: https://codereview.chromium.org/2694673003
Cr-Commit-Position: refs/heads/master@{#43197}
parent 8ec17c7b
......@@ -1205,7 +1205,7 @@ function CreateNumberFormat(locales, options) {
var mnsd = options['minimumSignificantDigits'];
var mxsd = options['maximumSignificantDigits'];
if (!IS_UNDEFINED(mnsd) || !IS_UNDEFINED(mxsd)) {
mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 0);
mnsd = getNumberOption(options, 'minimumSignificantDigits', 1, 21, 1);
defineWEProperty(internalOptions, 'minimumSignificantDigits', mnsd);
mxsd = getNumberOption(options, 'maximumSignificantDigits', mnsd, 21, 21);
......
......@@ -39,6 +39,8 @@ assertThrows('Intl.NumberFormat(undefined, {minimumFractionDigits: -1})');
assertThrows('Intl.NumberFormat(undefined, {maximumFractionDigits: 21})');
assertThrows('Intl.NumberFormat(undefined, {minimumSignificantDigits: 0})');
assertThrows('Intl.NumberFormat(undefined, {minimumSignificantDigits: 22})');
assertThrows('Intl.NumberFormat(undefined, {maximumSignificantDigits: 0})');
assertThrows('Intl.NumberFormat(undefined, {maximumSignificantDigits: 22})');
assertThrows('Intl.NumberFormat(undefined, ' +
'{minimumSignificantDigits: 5, maximumSignificantDigits: 2})');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment