Menu

Midpoint test failed

Help
2004-05-27
2004-05-28
  • Gustavo Gutierrez Sabogal

    Hello,

    As i wrote in a previous personal mail, when i compile the library and do make check two tests are failing on my machine:
    the midpoint test and the division test.

    The test file i am considering is the midpoint created by the compilation of midpoint.cpp

    After see that make check give me a two failed tests messages, i edit the midpoint.cpp file to get a trace of the inputs causing the error, so i modify it by adding only a cout line:

    for (int i=0;i<nb_intervals;++i) {
        cout << "midpoint(" << test_array[i].desc << ") =";
        cout << test_array[i].I.midpoint();
        if (test_array[i].I.set_contains(test_array[i].I.midpoint())) {
          cout << "       included" << endl;
        } else {
          //if here, there is a test error (correct me if wrong!!)
          cout << "       NOT included!! " << test_array[i].I.midpoint() << " in "<< test_array[i].I << endl;
        }
      }

    All tests prints an included message but there is one that doesn't:
    midpoint([empty]) =0       NOT included!! 0 in [empty]

    I am not so familiar with your library so i don't know if i am going in the right way.

    BTW, congratulations, your library is very useful and it  has a good design. The best part is that get away the setting of the rounding modes, that's great.

    Regards,
    ggutierrez

     
    • Frederic Goualard

      Hello Gustavo,

      The statement is correct but the result is not!

      Actually midpoint([empty]) should be NaN (which is, still, not included in [empty]) as stated in
      the comment for that method. This is indeed what is
      returned if the empty interval is interval::emptyset. However, for an interval which is empty but "symmetric", such as, say [oo, -oo], it returns 0.0 because the method lacks of an explicit check for emptyness.

      I have corrected this bug in Version 0.2.6 that should
      find its way on SourceForge in a matter of hours.

      Thank you for the bug tracking!

      Cheers,

      Frederic.

       
    • Gustavo Gutierrez Sabogal

      Hello Frederic,

      Wiith the new 0.2.6 version the bug was corrected and the midpoint test pass on my machie, but the division test does not. Since the test code is a little different than the midpoint one, i can not give you a trace for the bug, i only can write off the output:

      PASS: cos
      [-0.6666666666666667, -0.3333333333333333]
      FAIL: division
      [-inf, -max] % [-inf, -max] = [0, inf]
      [-inf, -max] % [-inf, -1] = [0, inf]
      [-inf, -max] % [-inf, -min] = [0, inf]
      [-inf, -max] % [-inf, -0] = [0, inf]
      [-inf, -max] % [-inf, 0] = [0, inf]
      [-inf, -max] % [-inf, min] = [-inf, inf]
      [-inf, -max] % [-inf, 1] = [-inf, inf]

      because of the sign '%' i think the relational division is the failing test, i don't know if all output is useful so i put only a few lines.

      The main loop for the relational division test is the following, however it is  a little different and the result is not tested for inclusion with any other known (teoretical) interval.

      for (int i=0;i<nb_intervals;++i) {
          for (int j=0;j<nb_intervals;++j) {
            cout << test_array[i].desc << " % " << test_array[j].desc << " = ";
            cout << test_array[i].I % test_array[j].I << endl;
                                                                                           }
      Any help you can give me is highly appreciate,

      Regards,
      Gustavo.

       
    • Frederic Goualard

      Hello Gustavo,

      My mistake: division.cpp contains a call to exit(1)
      that should be removed, together with the line just before it. These were added to make a specific test and I forgot to remove them afterwards.

      Everything should go smoothly from that point.

      Cheers,

      Frederic.

       
    • Gustavo Gutierrez Sabogal

      Hello Frederic,

      I did what you told me and now all tests passed.

      Thanks a lot,

      Gustavo

       

Log in to post a comment.