Ignore:
Timestamp:
Aug 20, 2010, 9:11:30 PM (13 years ago)
Author:
Peter
Message:

fixed more problems with overflow in Fisher. refs #638

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.6-stable/yat/statistics/Fisher.cc

    r2317 r2319  
    6666  {
    6767    // use floting point arithmetic to avoid overflow
    68     double N = static_cast<double>(a_) + static_cast<double>(b_)
    69       + static_cast<double>(c_) + static_cast<double>(d_);
    70     a =((a_+b_)*(a_+c_)) / N;
    71     b =((a_+b_)*(b_+d_)) / N;
    72     c =((c_+d_)*(a_+c_)) / N;
    73     d =((c_+d_)*(b_+d_)) / N;
     68    double a1 = a_;
     69    double b1 = b_;
     70    double c1 = c_;
     71    double d1 = d_;
     72    double N = a1 + b1 + c1 + d1;
     73    a =((a1+b1)*(a1+c1)) / N;
     74    b =((a1+b1)*(b1+d1)) / N;
     75    c =((c1+d1)*(a1+c1)) / N;
     76    d =((c1+d1)*(b1+d1)) / N;
    7477  }
    7578
Note: See TracChangeset for help on using the changeset viewer.