You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/08/28 02:54:47 UTC

[GitHub] [arrow] sagnikc-dremio commented on a change in pull request #8035: ARROW-9641: [C++][Gandiva] Implement round() for floating point and double floating point numbers

sagnikc-dremio commented on a change in pull request #8035:
URL: https://github.com/apache/arrow/pull/8035#discussion_r478802287



##########
File path: cpp/src/gandiva/precompiled/extended_math_ops_test.cc
##########
@@ -87,6 +87,20 @@ TEST(TestExtendedMathOps, TestLogWithBase) {
   EXPECT_EQ(context1.has_error(), false);
 }
 
+TEST(TestExtendedMathOps, TestRoundDecimal) {
+  EXPECT_FLOAT_EQ(round_float32_int32(1234.789, 2), 1234.79);
+  EXPECT_FLOAT_EQ(round_float32_int32(1234.12345, -3), 1000);
+  EXPECT_FLOAT_EQ(round_float32_int32(-1234.4567, 3), -1234.457);
+  EXPECT_FLOAT_EQ(round_float32_int32(-1234.4567, -3), -1000);
+  EXPECT_FLOAT_EQ(round_float32_int32(1234.4567, 0), 1234);
+
+  VerifyFuzzyEquals(round_float64_int32(1234.789, 2), 1234.79);

Review comment:
       I am sorry, I did not fully understand your concern. Are you suggesting that some unit tests be added for `round_float64_int32()` where the first argument is INT_MAX+1 or INT_MIN-1?




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org