Skip to content

Commit 1ed571e

Browse files
committed
any (std::)abs() -> fabs(), to be consistent and safe
1 parent 9e00183 commit 1ed571e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Estimators.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ namespace mci
133133
int i_min = 0;
134134
for (int i2=1; i2<MAX_BLOCKS-MIN_BLOCKS+1-2*MAX_PLATEAU_AVERAGE; ++i2)
135135
{
136-
if ( abs(*(accdelta+i2)) < abs(*(accdelta+i_min)) ) i_min=i2;
136+
if ( fabs(*(accdelta+i2)) < fabs(*(accdelta+i_min)) ) i_min=i2;
137137
}
138138

139139
i_min+=MAX_PLATEAU_AVERAGE;
@@ -311,7 +311,7 @@ namespace mci
311311
{
312312
for (int j=0; j<ndim; ++j)
313313
{
314-
if ( abs(*(*(accdelta+i2)+j)) < abs( *(*(accdelta+(*(i_min+j)))+j) ) ) *(i_min+j)=i2;
314+
if ( fabs(*(*(accdelta+i2)+j)) < fabs( *(*(accdelta+(*(i_min+j)))+j) ) ) *(i_min+j)=i2;
315315
}
316316
}
317317
for (int j=0; j<ndim; ++j){ *(i_min+j) += MAX_PLATEAU_AVERAGE; }

src/MCIntegrator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void MCI::initialDecorrelation(const int &NdecorrelationSteps)
141141
this->sample(MIN_NMC, true);
142142
mci::MultiDimCorrelatedEstimator(MIN_NMC, _nobsdim, _datax, newestimate, newerrestim);
143143
for (i=0; i<_nobsdim; ++i) {
144-
if ( std::abs( *(oldestimate+i) - *(newestimate+i) ) > *(olderrestim+i) + *(newerrestim+i) ) {
144+
if ( fabs( *(oldestimate+i) - *(newestimate+i) ) > *(olderrestim+i) + *(newerrestim+i) ) {
145145
flag_loop=true;
146146
}
147147
}

0 commit comments

Comments
 (0)