Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Issue 1231613006: Make NumberFormat use the ICU currency data, fix bug in NumberFormat (Closed)

Created:
5 years, 5 months ago by hichris123
Modified:
5 years, 5 months ago
CC:
v8-dev
Base URL:
https://chromium.googlesource.com/v8/v8.git@master
Target Ref:
refs/pending/heads/master
Project:
v8
Visibility:
Public.

Description

Make NumberFormat use the ICU currency data, fix bug in NumberFormat NumberFormat previously just used a min of 0 digits after the decimal and a max of 3. This CL changes it so that we use the ICU currency data, and set the min and max to the number of numbers after the decimal point for each currency. This CL also fixes a small bug where if the minimum fraction digits is above 3 but the maximum fraction digits isn't set, then it returns with only three numbers after the decimal point. BUG=435465, 473104, 304722 LOG=Y Committed: https://crrev.com/ddb5c2d999c5ee6e31c4a9599bb3ddb293cc3f49 Cr-Commit-Position: refs/heads/master@{#29734}

Patch Set 1 #

Patch Set 2 : Add self to AUTHORS #

Patch Set 3 : Remove commment #

Patch Set 4 : Add in fix for bug 304722 #

Patch Set 5 : Add tests and fix crash #

Patch Set 6 : Fix license #

Patch Set 7 : Fix presubmit error #

Total comments: 2

Patch Set 8 : Use short form of license #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+58 lines, -7 lines) Patch
M AUTHORS View 1 1 chunk +1 line, -0 lines 0 comments Download
M src/i18n.cc View 1 2 3 4 1 chunk +18 lines, -1 line 1 comment Download
M src/i18n.js View 1 2 3 4 5 6 2 chunks +12 lines, -6 lines 0 comments Download
A test/intl/number-format/check-minimum-fraction-digits.js View 1 2 3 4 5 6 7 1 chunk +9 lines, -0 lines 0 comments Download
A test/intl/number-format/format-currency.js View 1 2 3 4 5 6 7 1 chunk +18 lines, -0 lines 0 comments Download

Messages

Total messages: 19 (5 generated)
hichris123
cira@ / mnita@: PTAL at this CL, which makes NumberFormat more accurate for currencies.
5 years, 5 months ago (2015-07-16 02:13:08 UTC) #2
hichris123
+jochen@ (I can't tell if cira@/mnita@ are still active on chromium. If they are or ...
5 years, 5 months ago (2015-07-16 19:07:27 UTC) #4
jochen (gone - plz use gerrit)
looks good, one comment https://codereview.chromium.org/1231613006/diff/120001/test/intl/number-format/format-currency.js File test/intl/number-format/format-currency.js (right): https://codereview.chromium.org/1231613006/diff/120001/test/intl/number-format/format-currency.js#newcode1 test/intl/number-format/format-currency.js:1: // Copyright 2015 the V8 ...
5 years, 5 months ago (2015-07-17 09:32:48 UTC) #5
hichris123
https://codereview.chromium.org/1231613006/diff/120001/test/intl/number-format/format-currency.js File test/intl/number-format/format-currency.js (right): https://codereview.chromium.org/1231613006/diff/120001/test/intl/number-format/format-currency.js#newcode1 test/intl/number-format/format-currency.js:1: // Copyright 2015 the V8 project authors. All rights ...
5 years, 5 months ago (2015-07-17 14:27:06 UTC) #6
jochen (gone - plz use gerrit)
lgtm
5 years, 5 months ago (2015-07-17 14:44:30 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1231613006/140001
5 years, 5 months ago (2015-07-17 14:44:44 UTC) #9
commit-bot: I haz the power
Try jobs failed on following builders: v8_presubmit on tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_presubmit/builds/4290)
5 years, 5 months ago (2015-07-17 14:47:22 UTC) #11
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1231613006/140001
5 years, 5 months ago (2015-07-17 14:48:10 UTC) #13
commit-bot: I haz the power
Committed patchset #8 (id:140001)
5 years, 5 months ago (2015-07-17 15:08:00 UTC) #14
commit-bot: I haz the power
Patchset 8 (id:??) landed as https://crrev.com/ddb5c2d999c5ee6e31c4a9599bb3ddb293cc3f49 Cr-Commit-Position: refs/heads/master@{#29734}
5 years, 5 months ago (2015-07-17 15:08:16 UTC) #15
mnita
I am afraid that this patch breaks functionality in formats other than currency. https://codereview.chromium.org/1231613006/diff/140001/src/i18n.cc File ...
5 years, 5 months ago (2015-07-17 15:48:54 UTC) #16
hichris123
On 2015/07/17 15:48:54, mnita wrote: > I am afraid that this patch breaks functionality in ...
5 years, 5 months ago (2015-07-17 15:54:13 UTC) #17
mnita
Apologies, I have missed the line above [ if (style == UNICODE_STRING_SIMPLE("currency")) ] :-( Puzzling ...
5 years, 5 months ago (2015-07-17 16:02:39 UTC) #18
hichris123
5 years, 5 months ago (2015-07-17 16:05:34 UTC) #19
Message was sent while issue was closed.
On 2015/07/17 16:02:39, mnita wrote:
> Apologies, I have missed the line above [ if (style ==
> UNICODE_STRING_SIMPLE("currency")) ]
> :-(
> 
> Puzzling thing is: why do we even have to do this?
> ICU gives the right results, I have tested it outside v8.
> I should probably download + build v8 and see what's going on.
> Just reading this code does not seem enough for me, right now.
> Or it is just Friday morning, and my brain is not fully awake...

Good morning. :) And sorry for passing you up on the review, I wasn't sure if
you were still contributing to Chromium/V8. I'll make sure to send any further
patches your way.

I think it's because we only pass the locale to ICU, not the currency. I saw on
NumberFormat/DecimalFormat there is a setCurrency() method... but I couldn't
tell if that actually impacted the fractional digits. I figured this would be an
okay way of doing it, but if there's a better way...

Powered by Google App Engine
This is Rietveld 408576698