Wes McKinney created ARROW-5059:
-----------------------------------

             Summary: [C++][Gandiva] cbrt_* floating point tests can fail due 
to exact comparisons
                 Key: ARROW-5059
                 URL: https://issues.apache.org/jira/browse/ARROW-5059
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++ - Gandiva
            Reporter: Wes McKinney
             Fix For: 0.14.0


I observed this when running the release verification on Ubuntu 14.04

{code}

[ RUN      ] TestExtendedMathOps.TestCbrt
/tmp/arrow-0.13.0.WeWDY/apache-arrow-0.13.0/cpp/src/gandiva/precompiled/extended_math_ops_test.cc:27:
 Failure
      Expected: cbrt_float32(27)
      Which is: 3
To be equal to: 3
/tmp/arrow-0.13.0.WeWDY/apache-arrow-0.13.0/cpp/src/gandiva/precompiled/extended_math_ops_test.cc:28:
 Failure
      Expected: cbrt_float64(27)
      Which is: 3
To be equal to: 3
/tmp/arrow-0.13.0.WeWDY/apache-arrow-0.13.0/cpp/src/gandiva/precompiled/extended_math_ops_test.cc:29:
 Failure
      Expected: cbrt_float64(-27)
      Which is: -3
To be equal to: -3
{code}

The tests in question:

{code}
TEST(TestExtendedMathOps, TestCbrt) {
  EXPECT_EQ(cbrt_int32(27), 3);
  EXPECT_EQ(cbrt_int64(27), 3);
  EXPECT_EQ(cbrt_float32(27), 3);
  EXPECT_EQ(cbrt_float64(27), 3);
  EXPECT_EQ(cbrt_float64(-27), -3);

  EXPECT_EQ(cbrt_float32(15.625), 2.5);
  EXPECT_EQ(cbrt_float64(15.625), 2.5);
}
{code}

I believe that assertions involving floating point equality need to be 
approximate (up to a typical epsilon like 1E-14/1E-15)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to