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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: 0.14.0
    • Component/s: C++ - Gandiva
    • Labels:
      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

              • Assignee:
                praveenbingo Praveen Kumar Desabandu
                Reporter:
                wesmckinn Wes McKinney
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: