Skip to content

Commit 8cdc70b

Browse files
committed
Try using AssertWithinUlp
1 parent 18e2412 commit 8cdc70b

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

cpp/src/arrow/compute/kernels/aggregate_test.cc

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3275,15 +3275,8 @@ void CheckVarStd(const Datum& array, const VarianceOptions& options,
32753275
auto var = checked_cast<const DoubleScalar*>(out_var.scalar().get());
32763276
auto std = checked_cast<const DoubleScalar*>(out_std.scalar().get());
32773277
ASSERT_TRUE(var->is_valid && std->is_valid);
3278-
// Near zero these macros don't work as well
3279-
// (and MinGW can give results slightly off from zero)
3280-
if (std::abs(expected_var) < 1e-20) {
3281-
ASSERT_NEAR(std->value * std->value, var->value, 1e-20);
3282-
ASSERT_NEAR(var->value, expected_var, 1e-20);
3283-
} else {
3284-
ASSERT_DOUBLE_EQ(std->value * std->value, var->value);
3285-
ASSERT_DOUBLE_EQ(var->value, expected_var); // < 4ULP
3286-
}
3278+
AssertWithinUlp(std->value * std->value, var->value, /*n_ulps=*/3);
3279+
AssertWithinUlp(var->value, expected_var, /*n_ulps=*/3);
32873280
}
32883281

32893282
template <typename ArrowType>

0 commit comments

Comments
 (0)