Ignore:
Timestamp:
Sep 4, 2006, 5:16:57 PM (16 years ago)
Author:
Markus Ringnér
Message:

Fixed problems with Averager that sometimes appeared as failures in averager_test when optimization is turned on

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/averager_test.cc

    r617 r620  
    5151  }
    5252
    53   Averager* a1 = new Averager(1+3+5,1+9+25,3);
     53
     54  Averager* a1 = new Averager(1.0+3+5,1.0+9+25,3);
    5455  if (!equal(a,*a1)){
    5556    ok=false;
    56     std::cout << a.sum_x() << std::endl;
    57     std::cout << a.sum_xx() << std::endl;
    58     std::cout << a.n() << std::endl;
    59     std::cout << a.variance() << std::endl;
    60     std::cout << a.mean() << std::endl;
    61     std::cout << a1->sum_x() << std::endl;
    62     std::cout << a1->sum_xx() << std::endl;
    63     std::cout << a1->n() << std::endl;
    64     std::cout << a1->variance() << std::endl;
    65     std::cout << a1->mean() << std::endl;
     57    std::cout.precision(25);
     58    std::cout << equal(a,*a1) << std::endl;
     59    std::cout << a.sum_x() << '\t' << a1->sum_x() << std::endl;
     60    std::cout << a.sum_xx() << '\t' << a1->sum_xx() << std::endl;
     61    std::cout << a.n() << '\t' << a1->n() << std::endl;
     62    std::cout << a.variance() << '\t' << a1->variance() << std::endl;
     63    std::cout << a.mean() << '\t' << a1->mean() << std::endl;
    6664    std::cout << a.mean() - a1->mean() << std::endl;
    6765    std::cout << a.variance() - a1->variance() << std::endl;
    68     *error << "error: Averager(const double x,const double xx,const long n)\n";
     66    *error << "error: Averager(double x, double xx, u_long n)\n";
    6967  }
    7068  delete a1;
     
    208206bool equal(const Averager& a, const Averager& b)
    209207{
    210 //  std::cout << (a.n()==b.n()) << std::endl;
     208//  std::cout << (a.n()==b.n()) << std::endl;
    211209//  std::cout << (a.mean()==b.mean()) << std::endl;
    212210//  std::cout << (a.variance()==b.variance()) << std::endl;
Note: See TracChangeset for help on using the changeset viewer.