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 2022/11/15 17:16:08 UTC

[GitHub] [arrow] drabastomek commented on a diff in pull request #14434: ARROW-15538: [C++] Expanding coverage of math functions from Substrait to Acero

drabastomek commented on code in PR #14434:
URL: https://github.com/apache/arrow/pull/14434#discussion_r1023063717


##########
cpp/src/arrow/compute/kernels/scalar_arithmetic_test.cc:
##########
@@ -1519,6 +1519,65 @@ TEST_F(TestUnaryArithmeticDecimal, AbsoluteValue) {
   }
 }
 
+TYPED_TEST(TestUnaryArithmeticFloating, Exp) {
+  using CType = typename TestFixture::CType;
+
+  auto min = std::numeric_limits<CType>::lowest();
+  auto max = std::numeric_limits<CType>::max();
+
+  auto exp = [](const Datum& arg, ArithmeticOptions, ExecContext* ctx) {
+    return Exp(arg, ctx);
+  };
+  // Empty arrays
+  this->AssertUnaryOp(exp, "[]", "[]");
+  // Array with nulls
+  this->AssertUnaryOp(exp, "[null]", "[null]");
+  this->AssertUnaryOp(exp, this->MakeNullScalar(), this->MakeNullScalar());
+  this->AssertUnaryOp(exp, "[-1.0, null, 10.0]",
+                      "[0.36787944117144233, null, 22026.465794806718]");
+  // Ordinary arrays (positive, negative, fractional, and zero inputs)
+  this->AssertUnaryOp(
+      exp, "[-10.0, 0, 0.5, 1.0]",
+      "[0.000045399929762484854,1.0,1.6487212707001282,2.718281828459045]");
+  this->AssertUnaryOp(exp, 1.3F, 3.6692964926535487F);
+  this->AssertUnaryOp(exp, this->MakeScalar(1.3F), this->MakeScalar(3.6692964926535487F));
+  // Arrays with infinites
+  this->AssertUnaryOp(exp, "[-Inf, Inf]", "[0, Inf]");
+  // Arrays with NaNs
+  this->SetNansEqual(true);
+  this->AssertUnaryOp(exp, "[NaN]", "[NaN]");
+  this->AssertUnaryOp(exp, "[NaN]", "[NaN]");
+  this->AssertUnaryOp(exp, "[NaN]", "[NaN]");

Review Comment:
   Good catch! Thanks @pitrou 



-- 
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: github-unsubscribe@arrow.apache.org

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