Skip to content

Commit

Permalink
any (std::)abs() -> fabs(), to be consistent and safe
Browse files Browse the repository at this point in the history
  • Loading branch information
Ithanil committed Jan 22, 2019
1 parent 9e00183 commit 1ed571e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Estimators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ namespace mci
int i_min = 0;
for (int i2=1; i2<MAX_BLOCKS-MIN_BLOCKS+1-2*MAX_PLATEAU_AVERAGE; ++i2)
{
if ( abs(*(accdelta+i2)) < abs(*(accdelta+i_min)) ) i_min=i2;
if ( fabs(*(accdelta+i2)) < fabs(*(accdelta+i_min)) ) i_min=i2;
}

i_min+=MAX_PLATEAU_AVERAGE;
Expand Down Expand Up @@ -311,7 +311,7 @@ namespace mci
{
for (int j=0; j<ndim; ++j)
{
if ( abs(*(*(accdelta+i2)+j)) < abs( *(*(accdelta+(*(i_min+j)))+j) ) ) *(i_min+j)=i2;
if ( fabs(*(*(accdelta+i2)+j)) < fabs( *(*(accdelta+(*(i_min+j)))+j) ) ) *(i_min+j)=i2;
}
}
for (int j=0; j<ndim; ++j){ *(i_min+j) += MAX_PLATEAU_AVERAGE; }
Expand Down
2 changes: 1 addition & 1 deletion src/MCIntegrator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void MCI::initialDecorrelation(const int &NdecorrelationSteps)
this->sample(MIN_NMC, true);
mci::MultiDimCorrelatedEstimator(MIN_NMC, _nobsdim, _datax, newestimate, newerrestim);
for (i=0; i<_nobsdim; ++i) {
if ( std::abs( *(oldestimate+i) - *(newestimate+i) ) > *(olderrestim+i) + *(newerrestim+i) ) {
if ( fabs( *(oldestimate+i) - *(newestimate+i) ) > *(olderrestim+i) + *(newerrestim+i) ) {
flag_loop=true;
}
}
Expand Down

0 comments on commit 1ed571e

Please sign in to comment.