summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2014-12-19 13:06:58 +0100
committerNoel Grandin <noelgrandin@gmail.com>2014-12-20 09:18:28 +0000
commit8abd002240e8d7666300bf6fa832a28988e9ed0a (patch)
tree1b108c029f895410f0ba50e61d3337a80dbfcd1d
parentaeeff83595a176805d74ad4e35d946eb6a8e1b25 (diff)
fdo#39440 sax, sc: reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I589e13ee086cffee481954215a97960db656e633 Reviewed-on: https://gerrit.libreoffice.org/13548 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sax/source/tools/converter.cxx2
-rw-r--r--sc/source/core/data/attarray.cxx13
-rw-r--r--sc/source/core/data/documen7.cxx3
-rw-r--r--sc/source/core/data/fillinfo.cxx3
-rw-r--r--sc/source/core/tool/callform.cxx3
-rw-r--r--sc/source/core/tool/chgtrack.cxx5
-rw-r--r--sc/source/core/tool/interpr2.cxx10
-rw-r--r--sc/source/core/tool/interpr3.cxx22
-rw-r--r--sc/source/core/tool/interpr5.cxx36
-rw-r--r--sc/source/core/tool/interpr6.cxx12
10 files changed, 41 insertions, 68 deletions
diff --git a/sax/source/tools/converter.cxx b/sax/source/tools/converter.cxx
index a83126908c48..e4d3c962a830 100644
--- a/sax/source/tools/converter.cxx
+++ b/sax/source/tools/converter.cxx
@@ -84,10 +84,10 @@ bool Converter::convertMeasure( sal_Int32& rValue,
nVal += (rString[nPos] - '0');
nPos++;
}
- double nDiv = 1.;
if( nPos < nLen && '.' == rString[nPos] )
{
nPos++;
+ double nDiv = 1.;
while( nPos < nLen &&
'0' <= rString[nPos] &&
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index 65af7f6f2814..0f7683cb746e 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -107,14 +107,13 @@ void ScAttrArray::TestData() const
void ScAttrArray::Reset( const ScPatternAttr* pPattern )
{
ScDocumentPool* pDocPool = pDocument->GetPool();
- const ScPatternAttr* pOldPattern;
ScAddress aAdrStart( nCol, 0, nTab );
ScAddress aAdrEnd ( nCol, 0, nTab );
for (SCSIZE i=0; i<nCount; i++)
{
// ensure that attributing changes text width of cell
- pOldPattern = pData[i].pPattern;
+ const ScPatternAttr* pOldPattern = pData[i].pPattern;
bool bNumFormatChanged;
if ( ScGlobal::CheckWidthInvalidate( bNumFormatChanged,
pPattern->GetItemSet(), pOldPattern->GetItemSet() ) )
@@ -180,7 +179,6 @@ bool ScAttrArray::Search( SCROW nRow, SCSIZE& nIndex ) const
bool bFound = (nCount == 1);
long nLo = 0;
long nStartRow = 0;
- long nEndRow = 0;
while ( !bFound && nLo <= nHi )
{
i = (nLo + nHi) / 2;
@@ -188,7 +186,7 @@ bool ScAttrArray::Search( SCROW nRow, SCSIZE& nIndex ) const
nStartRow = (long) pData[i - 1].nRow;
else
nStartRow = -1;
- nEndRow = (long) pData[i].nRow;
+ const long nEndRow = (long) pData[i].nRow;
if (nEndRow < (long) nRow)
nLo = ++i;
else
@@ -1606,8 +1604,6 @@ bool ScAttrArray::RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags
void ScAttrArray::ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich )
{
- const ScPatternAttr* pOldPattern;
-
SCSIZE nIndex;
SCROW nRow;
SCROW nThisRow;
@@ -1618,7 +1614,7 @@ void ScAttrArray::ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16*
while ( nThisRow <= nEndRow )
{
- pOldPattern = pData[nIndex].pPattern;
+ const ScPatternAttr* pOldPattern = pData[nIndex].pPattern;
if ( pOldPattern->HasItemsSet( pWhich ) )
{
ScPatternAttr aNewPattern(*pOldPattern);
@@ -2147,7 +2143,6 @@ void ScAttrArray::DeleteArea(SCROW nStartRow, SCROW nEndRow)
void ScAttrArray::DeleteHardAttr(SCROW nStartRow, SCROW nEndRow)
{
const ScPatternAttr* pDefPattern = pDocument->GetDefPattern();
- const ScPatternAttr* pOldPattern;
SCSIZE nIndex;
SCROW nRow;
@@ -2159,7 +2154,7 @@ void ScAttrArray::DeleteHardAttr(SCROW nStartRow, SCROW nEndRow)
while ( nThisRow <= nEndRow )
{
- pOldPattern = pData[nIndex].pPattern;
+ const ScPatternAttr* pOldPattern = pData[nIndex].pPattern;
if ( pOldPattern->GetItemSet().Count() ) // hard attributes ?
{
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index af7337eb0aa2..1871a2483a6d 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -589,13 +589,12 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
{
// outside the loop, check if any sheet has a "calculate" event script
bool bCalcEvent = HasAnySheetEventScript( SC_SHEETEVENT_CALCULATE, true );
- SvtBroadcaster* pBC;
ScFormulaCell* pTrack;
ScFormulaCell* pNext;
pTrack = pFormulaTrack;
do
{
- pBC = GetBroadcaster(pTrack->aPos);
+ SvtBroadcaster* pBC = GetBroadcaster(pTrack->aPos);
ScHint aHint(nHintId, pTrack->aPos);
if (pBC)
pBC->Broadcast( aHint );
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index c2d36c08d3db..03289545af97 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -620,11 +620,10 @@ void ScDocument::FillInfo(
if ( pThisMarkArr->Search( nRow1, nIndex ) )
{
- bool bThisMarked;
do
{
nThisRow=pThisMarkArr->pData[nIndex].nRow; // Ende des Bereichs
- bThisMarked=pThisMarkArr->pData[nIndex].bMarked;
+ const bool bThisMarked=pThisMarkArr->pData[nIndex].bMarked;
do
{
diff --git a/sc/source/core/tool/callform.cxx b/sc/source/core/tool/callform.cxx
index a17cc88161ce..9ab34f659ca0 100644
--- a/sc/source/core/tool/callform.cxx
+++ b/sc/source/core/tool/callform.cxx
@@ -196,7 +196,6 @@ bool InitExternalFunc(const OUString& rModuleName)
// Schnittstelle initialisieren
AdvData pfCallBack = &ScAddInAsyncCallBack;
- FuncData* pFuncData;
FuncCollection* pFuncCol = ScGlobal::GetFuncCollection();
sal_uInt16 nCount;
(*((GetFuncCountPtr)fpGetCount))(nCount);
@@ -225,7 +224,7 @@ bool InitExternalFunc(const OUString& rModuleName)
}
OUString aInternalName( cInternalName, strlen(cInternalName), osl_getThreadTextEncoding() );
OUString aFuncName( cFuncName, strlen(cFuncName), osl_getThreadTextEncoding() );
- pFuncData = new FuncData( pModuleData,
+ FuncData* pFuncData = new FuncData( pModuleData,
aInternalName,
aFuncName,
i,
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 18006ac0d452..704c0390fbdb 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -357,9 +357,9 @@ bool ScChangeAction::IsDeletedInDelType( ScChangeActionType eDelType ) const
default:
eInsType = SC_CAT_NONE;
}
- ScChangeAction* p;
while ( pL )
{
+ ScChangeAction* p;
if ( (p = pL->GetAction()) != NULL &&
(p->GetType() == eDelType || p->GetType() == eInsType) )
return true;
@@ -4147,10 +4147,9 @@ bool ScChangeTrack::SelectContent( ScChangeAction* pAct, bool bOldest )
bOk &= pContent->Select( pDoc, this, bOldest, NULL );
// now the matrix is inserted and new content values are ready
- ScChangeActionContent* pNew;
while ( !aRejectActions.empty() )
{
- pNew = aRejectActions.top();
+ ScChangeActionContent* pNew = aRejectActions.top();
aRejectActions.pop();
ScAddress aPos( pNew->GetBigRange().aStart.MakeAddress() );
ScCellValue aCell;
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx
index 8fa70fb230e2..df28b08ecdee 100644
--- a/sc/source/core/tool/interpr2.cxx
+++ b/sc/source/core/tool/interpr2.cxx
@@ -1037,7 +1037,7 @@ void ScInterpreter::ScIRR()
fEstimated = 0.1;
sal_uInt16 sPos = sp; //memory the position of the stack
double fEps = 1.0;
- double x, xNew, fValue, fNom, fDenom, nCount;
+ double x, fValue;
if (fEstimated == -1.0)
x = 0.1; // default result for divion by zero
else
@@ -1058,9 +1058,9 @@ void ScInterpreter::ScIRR()
while (fEps > SCdEpsilon && nItCount < nIterationsMax)
{ // Newtons method:
sp = sPos; // reset stack
- nCount = 0.0;
- fNom = 0.0;
- fDenom = 0.0;
+ double nCount = 0.0;
+ double fNom = 0.0;
+ double fDenom = 0.0;
sal_uInt16 nErr = 0;
PopDoubleRef( aRange );
ScValueIterator aValIter(pDok, aRange, mnSubTotalFlags);
@@ -1077,7 +1077,7 @@ void ScInterpreter::ScIRR()
}
SetError(nErr);
}
- xNew = x - fNom / fDenom; // x(i+1) = x(i)-f(x(i))/f'(x(i))
+ double xNew = x - fNom / fDenom; // x(i+1) = x(i)-f(x(i))/f'(x(i))
nItCount++;
fEps = fabs(xNew - x);
x = xNew;
diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx
index 5e0af0df2825..90b5cf7dca1a 100644
--- a/sc/source/core/tool/interpr3.cxx
+++ b/sc/source/core/tool/interpr3.cxx
@@ -923,7 +923,7 @@ double ScInterpreter::GetBetaDistPDF(double fX, double fA, double fB)
*/
static double lcl_GetBetaHelperContFrac(double fX, double fA, double fB)
{ // like old version
- double a1, b1, a2, b2, fnorm, apl2m, d2m, d2m1, cfnew, cf;
+ double a1, b1, a2, b2, fnorm, cfnew, cf;
a1 = 1.0; b1 = 1.0;
b2 = 1.0 - (fA+fB)/(fA+1.0)*fX;
if (b2 == 0.0)
@@ -948,9 +948,9 @@ static double lcl_GetBetaHelperContFrac(double fX, double fA, double fB)
bool bfinished = false;
do
{
- apl2m = fA + 2.0*rm;
- d2m = rm*(fB-rm)*fX/((apl2m-1.0)*apl2m);
- d2m1 = -(fA+rm)*(fA+fB+rm)*fX/(apl2m*(apl2m+1.0));
+ const double apl2m = fA + 2.0*rm;
+ const double d2m = rm*(fB-rm)*fX/((apl2m-1.0)*apl2m);
+ const double d2m1 = -(fA+rm)*(fA+fB+rm)*fX/(apl2m*(apl2m+1.0));
a1 = (a2+d2m*a1)*fnorm;
b1 = (b2+d2m*b1)*fnorm;
a2 = a1 + d2m1*a2*fnorm;
@@ -1441,11 +1441,11 @@ void ScInterpreter::ScCritBinom()
else
{
// accumulate BinomDist until accumulated BinomDist reaches alpha
- double fSum = 0.0, x;
+ double fSum = 0.0;
sal_uInt32 max = static_cast<sal_uInt32> (n), i;
for (i = 0; i < max && fSum < alpha; i++)
{
- x = GetBetaDistPDF( p, ( i + 1 ), ( n - i + 1 ) )/( n + 1 );
+ const double x = GetBetaDistPDF( p, ( i + 1 ), ( n - i + 1 ) )/( n + 1 );
if ( !nGlobalError )
{
fSum += x;
@@ -1477,12 +1477,12 @@ void ScInterpreter::ScCritBinom()
else
{
// accumulate BinomDist until accumulated BinomDist reaches alpha
- double fSum = 0.0, x;
+ double fSum = 0.0;
sal_uInt32 max = static_cast<sal_uInt32> (n), i;
alpha = 1 - alpha;
for (i = 0; i < max && fSum < alpha; i++)
{
- x = GetBetaDistPDF( q, ( i + 1 ), ( n - i + 1 ) )/( n + 1 );
+ const double x = GetBetaDistPDF( q, ( i + 1 ), ( n - i + 1 ) )/( n + 1 );
if ( !nGlobalError )
{
fSum += x;
@@ -2885,7 +2885,6 @@ void ScInterpreter::ScKurt()
vSum += (values[i] - fMean) * (values[i] - fMean);
double fStdDev = sqrt(vSum / (fCount - 1.0));
- double dx = 0.0;
double xpower4 = 0.0;
if (fStdDev == 0.0)
@@ -2896,7 +2895,7 @@ void ScInterpreter::ScKurt()
for (size_t i = 0; i < values.size(); i++)
{
- dx = (values[i] - fMean) / fStdDev;
+ double dx = (values[i] - fMean) / fStdDev;
xpower4 = xpower4 + (dx * dx * dx * dx);
}
@@ -3287,7 +3286,6 @@ void ScInterpreter::CalculateSkewOrSkewp( bool bSkewp )
vSum += (values[i] - fMean) * (values[i] - fMean);
double fStdDev = sqrt( vSum / (bSkewp ? fCount : (fCount - 1.0)));
- double dx = 0.0;
double xcube = 0.0;
if (fStdDev == 0)
@@ -3298,7 +3296,7 @@ void ScInterpreter::CalculateSkewOrSkewp( bool bSkewp )
for (size_t i = 0; i < values.size(); ++i)
{
- dx = (values[i] - fMean) / fStdDev;
+ double dx = (values[i] - fMean) / fStdDev;
xcube = xcube + (dx * dx * dx);
}
diff --git a/sc/source/core/tool/interpr5.cxx b/sc/source/core/tool/interpr5.cxx
index 9475f3f288fe..e7b8b658c15c 100644
--- a/sc/source/core/tool/interpr5.cxx
+++ b/sc/source/core/tool/interpr5.cxx
@@ -2021,16 +2021,12 @@ bool lcl_CalculateQRdecomposition(ScMatrixRef pMatA,
bool lcl_TCalculateQRdecomposition(ScMatrixRef pMatA,
::std::vector< double>& pVecR, SCSIZE nK, SCSIZE nN)
{
- double fScale ;
- double fEuclid ;
- double fFactor ;
- double fSignum ;
double fSum ;
// ScMatrix matrices are zero based, index access (column,row)
for (SCSIZE row = 0; row <nK; row++)
{
// calculate vector u of the householder transformation
- fScale = lcl_TGetColumnMaximumNorm(pMatA, row, row, nN);
+ const double fScale = lcl_TGetColumnMaximumNorm(pMatA, row, row, nN);
if (fScale == 0.0)
{
// A is singular
@@ -2039,9 +2035,9 @@ bool lcl_TCalculateQRdecomposition(ScMatrixRef pMatA,
for (SCSIZE col = row; col <nN; col++)
pMatA->PutDouble( pMatA->GetDouble(col,row)/fScale, col, row);
- fEuclid = lcl_TGetColumnEuclideanNorm(pMatA, row, row, nN);
- fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(row,row)));
- fSignum = lcl_GetSign(pMatA->GetDouble(row,row));
+ const double fEuclid = lcl_TGetColumnEuclideanNorm(pMatA, row, row, nN);
+ const double fFactor = 1.0/fEuclid/(fEuclid + fabs(pMatA->GetDouble(row,row)));
+ const double fSignum = lcl_GetSign(pMatA->GetDouble(row,row));
pMatA->PutDouble( pMatA->GetDouble(row,row) + fSignum*fEuclid, row,row);
pVecR[row] = -fSignum * fScale * fEuclid;
@@ -2099,13 +2095,12 @@ void lcl_SolveWithUpperRightTriangle(ScMatrixRef pMatA,
SCSIZE nK, bool bIsTransposed)
{
// ScMatrix matrices are zero based, index access (column,row)
- double fSum;
SCSIZE row;
// SCSIZE is never negative, therefore test with rowp1=row+1
for (SCSIZE rowp1 = nK; rowp1>0; rowp1--)
{
row = rowp1-1;
- fSum = pMatS->GetDouble(row);
+ double fSum = pMatS->GetDouble(row);
for (SCSIZE col = rowp1; col<nK ; col++)
if (bIsTransposed)
fSum -= pMatA->GetDouble(row,col) * pMatS->GetDouble(col);
@@ -2126,10 +2121,9 @@ void lcl_SolveWithLowerLeftTriangle(ScMatrixRef pMatA,
SCSIZE nK, bool bIsTransposed)
{
// ScMatrix matrices are zero based, index access (column,row)
- double fSum;
for (SCSIZE row = 0; row < nK; row++)
{
- fSum = pMatT -> GetDouble(row);
+ double fSum = pMatT -> GetDouble(row);
for (SCSIZE col=0; col < row; col++)
{
if (bIsTransposed)
@@ -2152,10 +2146,9 @@ void lcl_ApplyUpperRightTriangle(ScMatrixRef pMatA,
ScMatrixRef pMatZ, SCSIZE nK, bool bIsTransposed)
{
// ScMatrix matrices are zero based, index access (column,row)
- double fSum;
for (SCSIZE row = 0; row < nK; row++)
{
- fSum = pVecR[row] * pMatB->GetDouble(row);
+ double fSum = pVecR[row] * pMatB->GetDouble(row);
for (SCSIZE col = row+1; col < nK; col++)
if (bIsTransposed)
fSum += pMatA->GetDouble(row,col) * pMatB->GetDouble(col);
@@ -2178,10 +2171,9 @@ double lcl_GetMeanOverAll(ScMatrixRef pMat, SCSIZE nN)
void lcl_CalculateColumnMeans(ScMatrixRef pX, ScMatrixRef pResMat,
SCSIZE nC, SCSIZE nR)
{
- double fSum = 0.0;
for (SCSIZE i=0; i < nC; i++)
{
- fSum =0.0;
+ double fSum =0.0;
for (SCSIZE k=0; k < nR; k++)
fSum += pX->GetDouble(i,k); // GetDouble(Column,Row)
pResMat ->PutDouble( fSum/static_cast<double>(nR),i);
@@ -2193,10 +2185,9 @@ void lcl_CalculateColumnMeans(ScMatrixRef pX, ScMatrixRef pResMat,
void lcl_CalculateRowMeans(ScMatrixRef pX, ScMatrixRef pResMat,
SCSIZE nC, SCSIZE nR)
{
- double fSum = 0.0;
for (SCSIZE k=0; k < nR; k++)
{
- fSum =0.0;
+ double fSum = 0.0;
for (SCSIZE i=0; i < nC; i++)
fSum += pX->GetDouble(i,k); // GetDouble(Column,Row)
pResMat ->PutDouble( fSum/static_cast<double>(nC),k);
@@ -2228,10 +2219,9 @@ double lcl_GetSSresid(ScMatrixRef pMatX, ScMatrixRef pMatY, double fSlope,
SCSIZE nN)
{
double fSum = 0.0;
- double fTemp = 0.0;
for (SCSIZE i=0; i<nN; i++)
{
- fTemp = pMatY->GetDouble(i) - fSlope * pMatX->GetDouble(i);
+ const double fTemp = pMatY->GetDouble(i) - fSlope * pMatX->GetDouble(i);
fSum += fTemp * fTemp;
}
return fSum;
@@ -2676,7 +2666,6 @@ void ScInterpreter::CalulateRGPRKP(bool _bRKP)
// = RMSE * sqrt( Xmean * (R' R)^(-1) * Xmean' + 1/N)
// (R' R)^(-1) = R^(-1) * (R')^(-1). Do not calculate it as
// a whole matrix, but iterate over unit vectors.
- double fSigmaSlope = 0.0;
double fSigmaIntercept = 0.0;
double fPart; // for Xmean * single column of (R' R)^(-1)
for (SCSIZE col = 0; col < K; col++)
@@ -2689,7 +2678,7 @@ void ScInterpreter::CalulateRGPRKP(bool _bRKP)
// Solve R * Znew = Zold
lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K, false);
// now Z is column col in (R' R)^(-1)
- fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(col));
+ double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(col));
pResMat->PutDouble(fSigmaSlope, K-1-col, 1);
// (R' R) ^(-1) is symmetric
if (bConstant)
@@ -2835,7 +2824,6 @@ void ScInterpreter::CalulateRGPRKP(bool _bRKP)
// (R' R)^(-1) = R^(-1) * (R')^(-1). Do not calculate it as
// a whole matrix, but iterate over unit vectors.
// (R' R) ^(-1) is symmetric
- double fSigmaSlope = 0.0;
double fSigmaIntercept = 0.0;
double fPart; // for Xmean * single col of (R' R)^(-1)
for (SCSIZE row = 0; row < K; row++)
@@ -2848,7 +2836,7 @@ void ScInterpreter::CalulateRGPRKP(bool _bRKP)
// Solve R * Znew = Zold
lcl_SolveWithUpperRightTriangle(pMatX, aVecR, pMatZ, K, true);
// now Z is column col in (R' R)^(-1)
- fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(row));
+ double fSigmaSlope = fRMSE * sqrt(pMatZ->GetDouble(row));
pResMat->PutDouble(fSigmaSlope, K-1-row, 1);
if (bConstant)
{
diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx
index 13c603f3d087..611a8e6e8cd9 100644
--- a/sc/source/core/tool/interpr6.cxx
+++ b/sc/source/core/tool/interpr6.cxx
@@ -44,29 +44,25 @@ double ScInterpreter::GetGammaContFraction( double fA, double fX )
double const fBigInv = ::std::numeric_limits<double>::epsilon();
double const fBig = 1.0/fBigInv;
double fCount = 0.0;
- double fNum = 0.0; // dummy value
double fY = 1.0 - fA;
double fDenom = fX + 2.0-fA;
- double fPk = 0.0; // dummy value
double fPkm1 = fX + 1.0;
double fPkm2 = 1.0;
- double fQk = 1.0; // dummy value
double fQkm1 = fDenom * fX;
double fQkm2 = fX;
double fApprox = fPkm1/fQkm1;
bool bFinished = false;
- double fR = 0.0; // dummy value
do
{
fCount = fCount +1.0;
fY = fY+ 1.0;
- fNum = fY * fCount;
+ const double fNum = fY * fCount;
fDenom = fDenom +2.0;
- fPk = fPkm1 * fDenom - fPkm2 * fNum;
- fQk = fQkm1 * fDenom - fQkm2 * fNum;
+ double fPk = fPkm1 * fDenom - fPkm2 * fNum;
+ const double fQk = fQkm1 * fDenom - fQkm2 * fNum;
if (fQk != 0.0)
{
- fR = fPk/fQk;
+ const double fR = fPk/fQk;
bFinished = (fabs( (fApprox - fR)/fR ) <= fHalfMachEps);
fApprox = fR;
}