diff options
author | Michael Weghorn <m.weghorn@posteo.de> | 2014-12-20 21:09:40 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2014-12-21 20:18:17 +0100 |
commit | 17fc7aa3b8fcd731fb05b5e17e23ee984d166a8f (patch) | |
tree | 247985f50367083dbfd1688e66db12c230d04fc1 /scaddins | |
parent | be34823092ce05002be61a50d0dbf156bb5095ba (diff) |
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings.
Change-Id: I390607e002e93cf7a6babc26d9be084d9f185058
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/bessel.cxx | 8 | ||||
-rw-r--r-- | scaddins/source/analysis/financial.cxx | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx index 5a4581b2ac15..9161655f4c1a 100644 --- a/scaddins/source/analysis/bessel.cxx +++ b/scaddins/source/analysis/bessel.cxx @@ -284,15 +284,13 @@ double BesselK( double fNum, sal_Int32 nOrder ) throw( IllegalArgumentException, case 1: return Besselk1( fNum ); default: { - double fBkp; - double fTox = 2.0 / fNum; double fBkm = Besselk0( fNum ); double fBk = Besselk1( fNum ); for( sal_Int32 n = 1 ; n < nOrder ; n++ ) { - fBkp = fBkm + double( n ) * fTox * fBk; + const double fBkp = fBkm + double( n ) * fTox * fBk; fBkm = fBk; fBk = fBkp; } @@ -438,15 +436,13 @@ double BesselY( double fNum, sal_Int32 nOrder ) throw( IllegalArgumentException, case 1: return Bessely1( fNum ); default: { - double fByp; - double fTox = 2.0 / fNum; double fBym = Bessely0( fNum ); double fBy = Bessely1( fNum ); for( sal_Int32 n = 1 ; n < nOrder ; n++ ) { - fByp = double( n ) * fTox * fBy - fBym; + const double fByp = double( n ) * fTox * fBy - fBym; fBym = fBy; fBy = fByp; } diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx index 7e79fba7d7d9..81cf3c428808 100644 --- a/scaddins/source/analysis/financial.cxx +++ b/scaddins/source/analysis/financial.cxx @@ -539,14 +539,13 @@ double SAL_CALL AnalysisAddIn::getXirr( static const sal_Int32 nMaxIter = 50; // Newton's method - try to find a fResultRate, so that lcl_sca_XirrResult() returns 0. - double fNewRate, fRateEps, fResultValue; sal_Int32 nIter = 0; bool bContLoop; do { - fResultValue = lcl_sca_XirrResult( aValues, aDates, fResultRate ); - fNewRate = fResultRate - fResultValue / lcl_sca_XirrResult_Deriv1( aValues, aDates, fResultRate ); - fRateEps = fabs( fNewRate - fResultRate ); + double fResultValue = lcl_sca_XirrResult( aValues, aDates, fResultRate ); + double fNewRate = fResultRate - fResultValue / lcl_sca_XirrResult_Deriv1( aValues, aDates, fResultRate ); + double fRateEps = fabs( fNewRate - fResultRate ); fResultRate = fNewRate; bContLoop = (fRateEps > fMaxEps) && (fabs( fResultValue ) > fMaxEps); } |