Changeset 841 for branches/0.3.1


Ignore:
Timestamp:
Apr 25, 2007, 10:20:54 AM (15 years ago)
Author:
Jari Häkkinen
Message:

Addresses #222. Comparing doubles with == is poor programming style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.3.1/test/regression_test.cc

    r831 r841  
    267267  r.fit(x,y);
    268268  rw.fit(x,y,w);
    269   if (r.predict(2000) != rw.predict(2000)){
     269  if (fabs(r.predict(2000) - rw.predict(2000))>1e-15) {
    270270    ok = false;
    271271    *error << "Error: predict not equal\n"
     
    382382
    383383  wr.fit(x2,y2,w2);
    384   if (wr.predict(2000) != predict){
     384  if (fabs(wr.predict(2000) - predict)>1e-15) {
    385385    ok = false;
    386386    *error << "Error: predict not equal.\n";
    387387  }
    388   if (wr.prediction_error2(2000) != prediction_error2){
     388  if (fabs(wr.prediction_error2(2000) - prediction_error2)>1e-13) {
    389389    ok = false;
    390390    *error << "Error: prediction_error2 not equal.\n";
    391391  }
    392   if (wr.r2() != r2){
     392  if (fabs(wr.r2() - r2)>1e-15) {
    393393    ok = false;
    394394    *error << "Error: r2 not equal.\n";
     
    396396    *error << "   r2: " << wr.r2() << "\n";
    397397  }
    398   if (wr.s2() != s2){
     398  if (fabs(wr.s2() - s2)>1e-15) {
    399399    ok = false;
    400400    *error << "Error: s2 not equal.\n";
    401401  }
    402   if (wr.standard_error2(2000) != standard_error2){
     402  if (fabs(wr.standard_error2(2000) - standard_error2)>1e-15) {
    403403    ok = false;
    404404    *error << "Error: standard_error2 not equal.\n";
Note: See TracChangeset for help on using the changeset viewer.