Ignore:
Timestamp:
Jan 18, 2006, 5:26:09 PM (17 years ago)
Author:
Peter
Message:

set tolerance to round_error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/averager_test.cc

    r490 r499  
    88
    99#include <fstream>
     10#include <limits>
    1011#include <iostream>
    1112
     
    7172     
    7273
    73   if ( a.variance() != a.std()*a.std() ){
     74  if ( fabs(a.variance() - a.std()*a.std())>
     75       std::numeric_limits<double>().round_error() ){
    7476    ok=false;
    7577    *error << "error: std squared should be variance" << std::endl;
    76     *error << "std: " << a.std() << std::endl;
     78    *error << "std2: " << a.std()*a.std() << std::endl;
    7779    *error << "variance: " << a.variance() << std::endl;
     80    *error << "difference is: " << a.std()*a.std()-a.variance() << std::endl;
    7881  }
    7982 
     
    97100  a.reset();
    98101  a.add(x);
    99   const double tol=0.0001;
     102  const double tol=std::numeric_limits<double>().round_error();
    100103  if (!equal(a,aw,tol,error)){
    101104    *error << "error: AveragerWeighted with unitary weights should "
Note: See TracChangeset for help on using the changeset viewer.