Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-5059

[C++][Gandiva] cbrt_* floating point tests can fail due to exact comparisons

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • None
    • 0.14.0
    • C++ - Gandiva
    • None

    Description

      I observed this when running the release verification on Ubuntu 14.04

      
      [ 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
      

      The tests in question:

      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);
      }
      

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

      Attachments

        Issue Links

          Activity

            People

              praveenbingo Praveen Kumar
              wesm Wes McKinney
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Slack

                  Issue deployment