Dan Hecht has posted comments on this change. Change subject: IMPALA-4813: Round on divide and multiply ......................................................................
Patch Set 4: (2 comments) http://gerrit.cloudera.org:8080/#/c/6132/4/be/src/runtime/decimal-value.inline.h File be/src/runtime/decimal-value.inline.h: Line 327: if (abs(2 * remainder) >= abs(y)) { > This is where I'm worried about overflow. Patient and grueling testing has should these be: 2 * abs(remainder) >= abs(y) with whatever casting is needed to make the abs() result unsigned? then we know that doesn't overflow, right? http://gerrit.cloudera.org:8080/#/c/6132/4/be/src/util/bit-util-test.cc File be/src/util/bit-util-test.cc: Line 60: EXPECT_EQ(BitUtil::IncrementAwayFromZero<int128_t>(-200), -201); > I had a test for that but it seems to have run away. if it doesn't work or is undefined, can we add an assert to IncrementAwayFromZero<> that we don't call it? i.e. instead of that last case returning sizeof * char, shouldn't we just assert that callers don't try to do that? -- To view, visit http://gerrit.cloudera.org:8080/6132 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ie6bfcbe37555b74598d409c6f84f06b0ae5c4312 Gerrit-PatchSet: 4 Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-Owner: Zach Amsden <[email protected]> Gerrit-Reviewer: Dan Hecht <[email protected]> Gerrit-Reviewer: Michael Ho Gerrit-Reviewer: Zach Amsden <[email protected]> Gerrit-HasComments: Yes
