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

Issue 977593004: Avoid uint64_t overflow in Decimal::operator/() and fix Decimal::ceil() (Closed)

Created:
5 years, 9 months ago by yosin_UTC9
Modified:
5 years, 9 months ago
Reviewers:
tkent
CC:
blink-reviews
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

Avoid uint64_t overflow in Decimal::operator/() This patch changes Decimal::operator/() not to cause uint64_t overflow in multiplication and addition during calculating quotient. Original code wrongly assumed each division loop generate at most two digits, by |MaxCoefficient < 100|, however this assumption is wrong such as 50,000 / 99,9999. This patch also fixes assertion failure |n> Precision|, where |Precision| == 18, in |scaleUp(x, n)| via |Decimal::ceil()|. Before this patch, we don't have 18 digits quotient with 10^-18 exponent from result of division operator. BUG=463510 TEST=blink_platform_unittests --gtest_filter=DecimalTest.Division Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=191294

Patch Set 1 #

Patch Set 2 : 2015-03-04T15:05:41 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+12 lines, -5 lines) Patch
M Source/platform/Decimal.cpp View 1 2 chunks +9 lines, -4 lines 0 comments Download
M Source/platform/DecimalTest.cpp View 1 2 chunks +3 lines, -1 line 0 comments Download

Messages

Total messages: 6 (3 generated)
tkent
lgtm
5 years, 9 months ago (2015-03-04 04:40:03 UTC) #2
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/977593004/20001
5 years, 9 months ago (2015-03-04 16:20:22 UTC) #5
commit-bot: I haz the power
5 years, 9 months ago (2015-03-04 17:20:31 UTC) #6
Message was sent while issue was closed.
Committed patchset #2 (id:20001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=191294

Powered by Google App Engine
This is Rietveld 408576698