File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
cpp/src/arrow/compute/kernels Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -4152,6 +4152,14 @@ class TestRandomQuantileKernel : public TestPrimitiveQuantileKernel<ArrowType> {
41524152
41534153 void VerifyTDigest (const std::shared_ptr<ChunkedArray>& chunked,
41544154 std::vector<double >& quantiles) {
4155+ // For some reason, TDigest computations with libc++ seem much less accurate.
4156+ // A possible explanation is that libc++ has less precise implementations
4157+ // of std::sin and std::asin, used in the TDigest implementation.
4158+ # ifdef _LIBCPP_VERSION
4159+ constexpr double kRelativeTolerance = 0.09 ;
4160+ # else
4161+ constexpr double kRelativeTolerance = 0.05 ;
4162+ # endif
41554163 TDigestOptions options (quantiles);
41564164 ASSERT_OK_AND_ASSIGN (Datum out, TDigest (chunked, options));
41574165 const auto & out_array = out.make_array ();
@@ -4166,7 +4174,7 @@ class TestRandomQuantileKernel : public TestPrimitiveQuantileKernel<ArrowType> {
41664174 const double * approx = out_array->data ()->GetValues <double >(1 );
41674175 for (size_t i = 0 ; i < quantiles.size (); ++i) {
41684176 const auto & exact_scalar = checked_pointer_cast<DoubleScalar>(exact[i][0 ].scalar ());
4169- const double tolerance = std::fabs (exact_scalar->value ) * 0.05 ;
4177+ const double tolerance = std::fabs (exact_scalar->value ) * kRelativeTolerance ;
41704178 EXPECT_NEAR (approx[i], exact_scalar->value , tolerance) << quantiles[i];
41714179 }
41724180 }
You can’t perform that action at this time.
0 commit comments