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


##########
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:
   Why three times?



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

Reply via email to