summaryrefslogtreecommitdiff
path: root/scaddins/source
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2004-11-18 16:03:19 +0000
committerOliver Bolte <obo@openoffice.org>2004-11-18 16:03:19 +0000
commitdd99e7117dbe705be2301be9a8ff7b2e42e8f9d5 (patch)
tree29e19e7e05734a97b75997e05b1bbbfabec85525 /scaddins/source
parentf39038fa84f0e876fbd56a000faed2700465a94a (diff)
INTEGRATION: CWS dr29 (1.44.6); FILE MERGED
2004/11/01 15:15:33 dr 1.44.6.1: #110793# DURATION
Diffstat (limited to 'scaddins/source')
-rw-r--r--scaddins/source/analysis/analysishelper.cxx14
1 files changed, 8 insertions, 6 deletions
diff --git a/scaddins/source/analysis/analysishelper.cxx b/scaddins/source/analysis/analysishelper.cxx
index 5301f85fdbc5..09e558d8331f 100644
--- a/scaddins/source/analysis/analysishelper.cxx
+++ b/scaddins/source/analysis/analysishelper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: analysishelper.cxx,v $
*
- * $Revision: 1.44 $
+ * $Revision: 1.45 $
*
- * last change: $Author: rt $ $Date: 2004-09-08 15:59:13 $
+ * last change: $Author: obo $ $Date: 2004-11-18 17:03:19 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1203,18 +1203,20 @@ double GetDuration( sal_Int32 nNullDate, sal_Int32 nSettle, sal_Int32 nMat, doub
fYield /= nFreq;
fYield += 1.0;
+ double nDiff = fYearfrac * nFreq - fNumOfCoups;
+
double t;
for( t = 1.0 ; t < fNumOfCoups ; t++ )
- fDur += t * ( fCoup ) / pow( fYield, t );
+ fDur += ( t + nDiff ) * ( fCoup ) / pow( fYield, t + nDiff );
- fDur += fNumOfCoups * ( fCoup + f100 ) / pow( fYield, fNumOfCoups );
+ fDur += ( fNumOfCoups + nDiff ) * ( fCoup + f100 ) / pow( fYield, fNumOfCoups + nDiff );
double p = 0.0;
for( t = 1.0 ; t < fNumOfCoups ; t++ )
- p += fCoup / pow( fYield, t );
+ p += fCoup / pow( fYield, t + nDiff );
- p += ( fCoup + f100 ) / pow( fYield, fNumOfCoups );
+ p += ( fCoup + f100 ) / pow( fYield, fNumOfCoups + nDiff );
fDur /= p;
fDur /= double( nFreq );