Arawoof06 commented on code in PR #50545:
URL: https://github.com/apache/arrow/pull/50545#discussion_r3671435742
##########
cpp/src/gandiva/precompiled/extended_math_ops_test.cc:
##########
@@ -203,6 +203,11 @@ TEST(TestExtendedMathOps, TestRound) {
EXPECT_EQ(round_int64_int32(-23453462343, -4), -23453460000);
EXPECT_EQ(round_int64_int32(-23453462343, -5), -23453500000);
EXPECT_EQ(round_int64_int32(345353425343, -12), 0);
+
+ // The most negative precision must be rejected by the range check rather
than
+ // negated into an out-of-range table index.
+ EXPECT_EQ(round_int32_int32(1234, std::numeric_limits<int32_t>::min()), 0);
+ EXPECT_EQ(round_int64_int32(345353425343,
std::numeric_limits<int32_t>::min()), 0);
Review Comment:
Good idea, added them. There's now a -9/-10 pair for the int32 overload and
-18/-19 for the int64 one, so the last in-range precision still rounds and one
past it returns 0. That pins the boundary against any future off-by-one.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]