cyb70289 commented on a change in pull request #9604:
URL: https://github.com/apache/arrow/pull/9604#discussion_r584741353
##########
File path: cpp/src/arrow/compute/kernels/aggregate_test.cc
##########
@@ -1205,6 +1205,21 @@ TEST_F(TestVarStdKernelMergeStability, Basics) {
#endif
}
+// Test round-off error
+class TestVarStdKernelRoundOff : public TestPrimitiveVarStdKernel<DoubleType>
{};
+
+TEST_F(TestVarStdKernelRoundOff, Basics) {
+ // build array: np.arange(321000, dtype='float64')
+ double value = 0;
+ ASSERT_OK_AND_ASSIGN(
+ auto array, ArrayFromBuilderVisitor(float64(), 321000,
[&](DoubleBuilder* builder) {
+ builder->UnsafeAppend(value++);
+ }));
+
+ // reference value from numpy.var()
+ this->AssertVarStdIs(*array, VarianceOptions{0}, 8586749999.916667);
+}
Review comment:
Looks not necessary, as internally `float32` is converted to `double`
before calculation, and there's no `float32` summation.
Will do some tests against numpy to see if additional test is required.
----------------------------------------------------------------
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:
[email protected]