1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #include "analysis.hxx"
30 #include "analysishelper.hxx"
31 #include <rtl/math.hxx>
35 double SAL_CALL
AnalysisAddIn::getAmordegrc( constREFXPS
& xOpt
,
36 double fCost
, sal_Int32 nDate
, sal_Int32 nFirstPer
, double fRestVal
,
37 double fPer
, double fRate
, const ANY
& rOB
) THROWDEF_RTE_IAE
39 if( nDate
> nFirstPer
|| fRate
<= 0.0 || fRestVal
> fCost
)
42 double fRet
= GetAmordegrc( GetNullDate( xOpt
), fCost
, nDate
, nFirstPer
, fRestVal
, fPer
, fRate
, getDateMode( xOpt
, rOB
) );
43 RETURN_FINITE( fRet
);
47 double SAL_CALL
AnalysisAddIn::getAmorlinc( constREFXPS
& xOpt
,
48 double fCost
, sal_Int32 nDate
, sal_Int32 nFirstPer
, double fRestVal
,
49 double fPer
, double fRate
, const ANY
& rOB
) THROWDEF_RTE_IAE
51 if( nDate
> nFirstPer
|| fRate
<= 0.0 || fRestVal
> fCost
)
54 double fRet
= GetAmorlinc( GetNullDate( xOpt
), fCost
, nDate
, nFirstPer
, fRestVal
, fPer
, fRate
, getDateMode( xOpt
, rOB
) );
55 RETURN_FINITE( fRet
);
59 double SAL_CALL
AnalysisAddIn::getAccrint( constREFXPS
& xOpt
,
60 sal_Int32 nIssue
, sal_Int32
/*nFirstInter*/, sal_Int32 nSettle
, double fRate
,
61 const ANY
&rVal
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
63 double fVal
= aAnyConv
.getDouble( xOpt
, rVal
, 1000.0 );
65 if( fRate
<= 0.0 || fVal
<= 0.0 || CHK_Freq
|| nIssue
>= nSettle
)
68 double fRet
= fVal
* fRate
* GetYearDiff( GetNullDate( xOpt
), nIssue
, nSettle
, getDateMode( xOpt
, rOB
) );
69 RETURN_FINITE( fRet
);
73 double SAL_CALL
AnalysisAddIn::getAccrintm( constREFXPS
& xOpt
,
74 sal_Int32 nIssue
, sal_Int32 nSettle
, double fRate
, const ANY
& rVal
, const ANY
& rOB
) THROWDEF_RTE_IAE
76 double fVal
= aAnyConv
.getDouble( xOpt
, rVal
, 1000.0 );
78 if( fRate
<= 0.0 || fVal
<= 0.0 || nIssue
>= nSettle
)
81 double fRet
= fVal
* fRate
* GetYearDiff( GetNullDate( xOpt
), nIssue
, nSettle
, getDateMode( xOpt
, rOB
) );
82 RETURN_FINITE( fRet
);
86 double SAL_CALL
AnalysisAddIn::getReceived( constREFXPS
& xOpt
,
87 sal_Int32 nSettle
, sal_Int32 nMat
, double fInvest
, double fDisc
, const ANY
& rOB
) THROWDEF_RTE_IAE
89 if( fInvest
<= 0.0 || fDisc
<= 0.0 )
92 double fRet
= fInvest
/ ( 1.0 - ( fDisc
* GetYearDiff( GetNullDate( xOpt
), nSettle
, nMat
, getDateMode( xOpt
, rOB
) ) ) );
93 RETURN_FINITE( fRet
);
97 double SAL_CALL
AnalysisAddIn::getDisc( constREFXPS
& xOpt
,
98 sal_Int32 nSettle
, sal_Int32 nMat
, double fPrice
, double fRedemp
, const ANY
& rOB
) THROWDEF_RTE_IAE
100 if( fPrice
<= 0.0 || fRedemp
<= 0.0 || nSettle
>= nMat
)
102 double fRet
= ( 1.0 - fPrice
/ fRedemp
) / GetYearFrac( xOpt
, nSettle
, nMat
, getDateMode( xOpt
, rOB
) );
103 RETURN_FINITE( fRet
);
107 double SAL_CALL
AnalysisAddIn::getDuration( constREFXPS
& xOpt
,
108 sal_Int32 nSettle
, sal_Int32 nMat
, double fCoup
, double fYield
, sal_Int32 nFreq
, const ANY
& rOB
)
111 if( fCoup
< 0.0 || fYield
< 0.0 || CHK_Freq
|| nSettle
>= nMat
)
114 double fRet
= GetDuration( GetNullDate( xOpt
), nSettle
, nMat
, fCoup
, fYield
, nFreq
, getDateMode( xOpt
, rOB
) );
115 RETURN_FINITE( fRet
);
119 double SAL_CALL
AnalysisAddIn::getEffect( double fNominal
, sal_Int32 nPeriods
) THROWDEF_RTE_IAE
121 if( nPeriods
< 1 || fNominal
<= 0.0 )
124 double fPeriods
= nPeriods
;
126 double fRet
= pow( 1.0 + fNominal
/ fPeriods
, fPeriods
) - 1.0;
127 RETURN_FINITE( fRet
);
131 double SAL_CALL
AnalysisAddIn::getCumprinc( double fRate
, sal_Int32 nNumPeriods
, double fVal
,
132 sal_Int32 nStartPer
, sal_Int32 nEndPer
, sal_Int32 nPayType
) THROWDEF_RTE_IAE
136 if( nStartPer
< 1 || nEndPer
< nStartPer
|| fRate
<= 0.0 || nEndPer
> nNumPeriods
|| nNumPeriods
<= 0 ||
137 fVal
<= 0.0 || ( nPayType
!= 0 && nPayType
!= 1 ) )
140 fRmz
= GetRmz( fRate
, nNumPeriods
, fVal
, 0.0, nPayType
);
144 sal_uInt32 nStart
= sal_uInt32( nStartPer
);
145 sal_uInt32 nEnd
= sal_uInt32( nEndPer
);
150 fKapZ
= fRmz
+ fVal
* fRate
;
157 for( sal_uInt32 i
= nStart
; i
<= nEnd
; i
++ )
160 fKapZ
+= fRmz
- ( GetZw( fRate
, double( i
- 2 ), fRmz
, fVal
, 1 ) - fRmz
) * fRate
;
162 fKapZ
+= fRmz
- GetZw( fRate
, double( i
- 1 ), fRmz
, fVal
, 0 ) * fRate
;
165 RETURN_FINITE( fKapZ
);
169 double SAL_CALL
AnalysisAddIn::getCumipmt( double fRate
, sal_Int32 nNumPeriods
, double fVal
,
170 sal_Int32 nStartPer
, sal_Int32 nEndPer
, sal_Int32 nPayType
) THROWDEF_RTE_IAE
174 if( nStartPer
< 1 || nEndPer
< nStartPer
|| fRate
<= 0.0 || nEndPer
> nNumPeriods
|| nNumPeriods
<= 0 ||
175 fVal
<= 0.0 || ( nPayType
!= 0 && nPayType
!= 1 ) )
178 fRmz
= GetRmz( fRate
, nNumPeriods
, fVal
, 0.0, nPayType
);
182 sal_uInt32 nStart
= sal_uInt32( nStartPer
);
183 sal_uInt32 nEnd
= sal_uInt32( nEndPer
);
193 for( sal_uInt32 i
= nStart
; i
<= nEnd
; i
++ )
196 fZinsZ
+= GetZw( fRate
, double( i
- 2 ), fRmz
, fVal
, 1 ) - fRmz
;
198 fZinsZ
+= GetZw( fRate
, double( i
- 1 ), fRmz
, fVal
, 0 );
203 RETURN_FINITE( fZinsZ
);
207 double SAL_CALL
AnalysisAddIn::getPrice( constREFXPS
& xOpt
,
208 sal_Int32 nSettle
, sal_Int32 nMat
, double fRate
, double fYield
, double fRedemp
, sal_Int32 nFreq
,
209 const ANY
& rOB
) THROWDEF_RTE_IAE
211 if( fYield
< 0.0 || fRate
< 0.0 || fRedemp
<= 0 || CHK_Freq
|| nSettle
>= nMat
)
214 double fRet
= getPrice_( GetNullDate( xOpt
), nSettle
, nMat
, fRate
, fYield
, fRedemp
, nFreq
, getDateMode( xOpt
, rOB
) );
215 RETURN_FINITE( fRet
);
219 double SAL_CALL
AnalysisAddIn::getPricedisc( constREFXPS
& xOpt
,
220 sal_Int32 nSettle
, sal_Int32 nMat
, double fDisc
, double fRedemp
, const ANY
& rOB
) THROWDEF_RTE_IAE
222 if( fDisc
<= 0.0 || fRedemp
<= 0 || nSettle
>= nMat
)
225 double fRet
= fRedemp
* ( 1.0 - fDisc
* GetYearDiff( GetNullDate( xOpt
), nSettle
, nMat
, getDateMode( xOpt
, rOB
) ) );
226 RETURN_FINITE( fRet
);
230 double SAL_CALL
AnalysisAddIn::getPricemat( constREFXPS
& xOpt
,
231 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nIssue
, double fRate
, double fYield
, const ANY
& rOB
)
234 if( fRate
< 0.0 || fYield
< 0.0 || nSettle
>= nMat
)
237 sal_Int32 nNullDate
= GetNullDate( xOpt
);
238 sal_Int32 nBase
= getDateMode( xOpt
, rOB
);
240 double fIssMat
= GetYearFrac( nNullDate
, nIssue
, nMat
, nBase
);
241 double fIssSet
= GetYearFrac( nNullDate
, nIssue
, nSettle
, nBase
);
242 double fSetMat
= GetYearFrac( nNullDate
, nSettle
, nMat
, nBase
);
244 double fRet
= 1.0 + fIssMat
* fRate
;
245 fRet
/= 1.0 + fSetMat
* fYield
;
246 fRet
-= fIssSet
* fRate
;
249 RETURN_FINITE( fRet
);
253 double SAL_CALL
AnalysisAddIn::getMduration( constREFXPS
& xOpt
,
254 sal_Int32 nSettle
, sal_Int32 nMat
, double fCoup
, double fYield
, sal_Int32 nFreq
, const ANY
& rOB
)
257 if( fCoup
< 0.0 || fYield
< 0.0 || CHK_Freq
)
260 double fRet
= GetDuration( GetNullDate( xOpt
), nSettle
, nMat
, fCoup
, fYield
, nFreq
, getDateMode( xOpt
, rOB
) );
261 fRet
/= 1.0 + ( fYield
/ double( nFreq
) );
262 RETURN_FINITE( fRet
);
266 double SAL_CALL
AnalysisAddIn::getNominal( double fRate
, sal_Int32 nPeriods
) THROWDEF_RTE_IAE
268 if( fRate
<= 0.0 || nPeriods
< 0 )
271 double fPeriods
= nPeriods
;
272 double fRet
= ( pow( fRate
+ 1.0, 1.0 / fPeriods
) - 1.0 ) * fPeriods
;
273 RETURN_FINITE( fRet
);
277 double SAL_CALL
AnalysisAddIn::getDollarfr( double fDollarDec
, sal_Int32 nFrac
) THROWDEF_RTE_IAE
283 double fFrac
= nFrac
;
285 double fRet
= modf( fDollarDec
, &fInt
);
289 fRet
*= pow( 10.0, -ceil( log10( fFrac
) ) );
293 RETURN_FINITE( fRet
);
297 double SAL_CALL
AnalysisAddIn::getDollarde( double fDollarFrac
, sal_Int32 nFrac
) THROWDEF_RTE_IAE
303 double fFrac
= nFrac
;
305 double fRet
= modf( fDollarFrac
, &fInt
);
309 fRet
*= pow( 10.0, ceil( log10( fFrac
) ) );
313 RETURN_FINITE( fRet
);
317 double SAL_CALL
AnalysisAddIn::getYield( constREFXPS
& xOpt
,
318 sal_Int32 nSettle
, sal_Int32 nMat
, double fCoup
, double fPrice
, double fRedemp
, sal_Int32 nFreq
, const ANY
& rOB
)
321 if( fCoup
< 0.0 || fPrice
<= 0.0 || fRedemp
<= 0.0 || CHK_Freq
|| nSettle
>= nMat
)
324 double fRet
= getYield_( GetNullDate( xOpt
), nSettle
, nMat
, fCoup
, fPrice
, fRedemp
, nFreq
, getDateMode( xOpt
, rOB
) );
325 RETURN_FINITE( fRet
);
329 double SAL_CALL
AnalysisAddIn::getYielddisc( constREFXPS
& xOpt
,
330 sal_Int32 nSettle
, sal_Int32 nMat
, double fPrice
, double fRedemp
, const ANY
& rOB
) THROWDEF_RTE_IAE
332 if( fPrice
<= 0.0 || fRedemp
<= 0.0 || nSettle
>= nMat
)
335 sal_Int32 nNullDate
= GetNullDate( xOpt
);
337 double fRet
= ( fRedemp
/ fPrice
) - 1.0;
338 fRet
/= GetYearFrac( nNullDate
, nSettle
, nMat
, getDateMode( xOpt
, rOB
) );
340 RETURN_FINITE( fRet
);
344 double SAL_CALL
AnalysisAddIn::getYieldmat( constREFXPS
& xOpt
,
345 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nIssue
, double fRate
, double fPrice
, const ANY
& rOB
)
348 if( fRate
< 0.0 || fRate
<= 0.0 || nSettle
>= nMat
)
351 double fRet
= GetYieldmat( GetNullDate( xOpt
), nSettle
, nMat
, nIssue
, fRate
, fPrice
, getDateMode( xOpt
, rOB
) );
352 RETURN_FINITE( fRet
);
356 double SAL_CALL
AnalysisAddIn::getTbilleq( constREFXPS
& xOpt
,
357 sal_Int32 nSettle
, sal_Int32 nMat
, double fDisc
) THROWDEF_RTE_IAE
361 sal_Int32 nDiff
= GetDiffDate360( xOpt
, nSettle
, nMat
, sal_True
);
363 if( fDisc
<= 0.0 || nSettle
>= nMat
|| nDiff
> 360 )
366 double fRet
= ( 365 * fDisc
) / ( 360 - ( fDisc
* double( nDiff
) ) );
367 RETURN_FINITE( fRet
);
371 double SAL_CALL
AnalysisAddIn::getTbillprice( constREFXPS
& xOpt
,
372 sal_Int32 nSettle
, sal_Int32 nMat
, double fDisc
) THROWDEF_RTE_IAE
374 if( fDisc
<= 0.0 || nSettle
> nMat
)
379 double fFraction
= GetYearFrac( xOpt
, nSettle
, nMat
, 0 ); // method: USA 30/360
382 if( modf( fFraction
, &fDummy
) == 0.0 )
385 double fRet
= 100.0 * ( 1.0 - fDisc
* fFraction
);
386 RETURN_FINITE( fRet
);
390 double SAL_CALL
AnalysisAddIn::getTbillyield( constREFXPS
& xOpt
, sal_Int32 nSettle
, sal_Int32 nMat
, double fPrice
)
393 sal_Int32 nDiff
= GetDiffDate360( xOpt
, nSettle
, nMat
, sal_True
);
396 if( fPrice
<= 0.0 || nSettle
>= nMat
|| nDiff
> 360 )
402 fRet
/= double( nDiff
);
405 RETURN_FINITE( fRet
);
409 double SAL_CALL
AnalysisAddIn::getOddfprice( constREFXPS
& xOpt
,
410 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nIssue
, sal_Int32 nFirstCoup
,
411 double fRate
, double fYield
, double fRedemp
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
413 if( fRate
< 0 || fYield
< 0 || CHK_Freq
|| nMat
<= nFirstCoup
|| nFirstCoup
<= nSettle
|| nSettle
<= nIssue
)
416 double fRet
= GetOddfprice( GetNullDate( xOpt
), nSettle
, nMat
, nIssue
, nFirstCoup
, fRate
, fYield
, fRedemp
, nFreq
, getDateMode( xOpt
, rOB
) );
417 RETURN_FINITE( fRet
);
421 double SAL_CALL
AnalysisAddIn::getOddfyield( constREFXPS
& xOpt
,
422 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nIssue
, sal_Int32 nFirstCoup
,
423 double fRate
, double fPrice
, double fRedemp
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
425 if( fRate
< 0 || fPrice
<= 0 || CHK_Freq
|| nMat
<= nFirstCoup
|| nFirstCoup
<= nSettle
|| nSettle
<= nIssue
)
428 double fRet
= GetOddfyield( GetNullDate( xOpt
), nSettle
, nMat
, nIssue
, nFirstCoup
, fRate
, fPrice
, fRedemp
, nFreq
,
429 getDateMode( xOpt
, rOB
) );
430 RETURN_FINITE( fRet
);
434 double SAL_CALL
AnalysisAddIn::getOddlprice( constREFXPS
& xOpt
,
435 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nLastInterest
,
436 double fRate
, double fYield
, double fRedemp
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
438 if( fRate
< 0 || fYield
< 0 || CHK_Freq
|| nMat
<= nSettle
|| nSettle
<= nLastInterest
)
441 double fRet
= GetOddlprice( GetNullDate( xOpt
), nSettle
, nMat
, nLastInterest
, fRate
, fYield
, fRedemp
, nFreq
,
442 getDateMode( xOpt
, rOB
) );
443 RETURN_FINITE( fRet
);
447 double SAL_CALL
AnalysisAddIn::getOddlyield( constREFXPS
& xOpt
,
448 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nLastInterest
,
449 double fRate
, double fPrice
, double fRedemp
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
451 if( fRate
< 0 || fPrice
<= 0 || CHK_Freq
|| nMat
<= nSettle
|| nSettle
<= nLastInterest
)
454 double fRet
= GetOddlyield( GetNullDate( xOpt
), nSettle
, nMat
, nLastInterest
, fRate
, fPrice
, fRedemp
, nFreq
,
455 getDateMode( xOpt
, rOB
) );
456 RETURN_FINITE( fRet
);
460 // ============================================================================
461 // XIRR helper functions
463 #define V_(i) (*rValues.Get(i))
464 #define D_(i) (*rDates.Get(i))
466 /** Calculates the resulting amount for the passed interest rate and the given XIRR parameters. */
467 double lcl_sca_XirrResult( const ScaDoubleList
& rValues
, const ScaDoubleList
& rDates
, double fRate
)
469 /* V_0 ... V_n = input values.
470 D_0 ... D_n = input dates.
471 R = input interest rate.
474 E_i := (D_i-D_0) / 365
477 f(R) = SUM ------- = V_0 + SUM ------- .
481 double r
= fRate
+ 1.0;
482 double fResult
= V_(0);
483 for( sal_uInt32 i
= 1, nCount
= rValues
.Count(); i
< nCount
; ++i
)
484 fResult
+= V_(i
) / pow( r
, (D_(i
) - D_0
) / 365.0 );
488 /** Calculates the first derivation of lcl_sca_XirrResult(). */
489 double lcl_sca_XirrResult_Deriv1( const ScaDoubleList
& rValues
, const ScaDoubleList
& rDates
, double fRate
)
491 /* V_0 ... V_n = input values.
492 D_0 ... D_n = input dates.
493 R = input interest rate.
496 E_i := (D_i-D_0) / 365
499 f'(R) = [ V_0 + SUM ------- ]'
503 = 0 + SUM -E_i ----------- r' = - SUM ----------- .
504 i=1 r^(E_i+1) i=1 r^(E_i+1)
507 double r
= fRate
+ 1.0;
508 double fResult
= 0.0;
509 for( sal_uInt32 i
= 1, nCount
= rValues
.Count(); i
< nCount
; ++i
)
511 double E_i
= (D_(i
) - D_0
) / 365.0;
512 fResult
-= E_i
* V_(i
) / pow( r
, E_i
+ 1.0 );
521 // ----------------------------------------------------------------------------
524 double SAL_CALL
AnalysisAddIn::getXirr(
525 constREFXPS
& xOpt
, const SEQSEQ( double )& rValues
, const SEQSEQ( sal_Int32
)& rDates
, const ANY
& rGuessRate
) THROWDEF_RTE_IAE
527 ScaDoubleList aValues
, aDates
;
528 aValues
.Append( rValues
);
529 aDates
.Append( rDates
);
531 if( (aValues
.Count() < 2) || (aValues
.Count() != aDates
.Count()) )
534 // result interest rate, initialized with passed guessed rate, or 10%
535 double fResultRate
= aAnyConv
.getDouble( xOpt
, rGuessRate
, 0.1 );
536 if( fResultRate
<= -1 )
539 // maximum epsilon for end of iteration
540 static const double fMaxEps
= 1e-10;
541 // maximum number of iterations
542 static const sal_Int32 nMaxIter
= 50;
544 // Newton's method - try to find a fResultRate, so that lcl_sca_XirrResult() returns 0.
545 double fNewRate
, fRateEps
, fResultValue
;
550 fResultValue
= lcl_sca_XirrResult( aValues
, aDates
, fResultRate
);
551 fNewRate
= fResultRate
- fResultValue
/ lcl_sca_XirrResult_Deriv1( aValues
, aDates
, fResultRate
);
552 fRateEps
= fabs( fNewRate
- fResultRate
);
553 fResultRate
= fNewRate
;
554 bContLoop
= (fRateEps
> fMaxEps
) && (fabs( fResultValue
) > fMaxEps
);
556 while( bContLoop
&& (++nIter
< nMaxIter
) );
560 RETURN_FINITE( fResultRate
);
564 // ============================================================================
566 double SAL_CALL
AnalysisAddIn::getXnpv(
567 double fRate
, const SEQSEQ( double )& rValues
, const SEQSEQ( sal_Int32
)& rDates
) THROWDEF_RTE_IAE
569 ScaDoubleList aValList
;
570 ScaDoubleList aDateList
;
572 aValList
.Append( rValues
);
573 aDateList
.Append( rDates
);
575 sal_Int32 nNum
= aValList
.Count();
577 if( nNum
!= sal_Int32( aDateList
.Count() ) || nNum
< 2 )
581 double fNull
= *aDateList
.Get( 0 );
584 for( sal_Int32 i
= 0 ; i
< nNum
; i
++ )
585 fRet
+= *aValList
.Get( i
) / ( pow( fRate
, ( *aDateList
.Get( i
) - fNull
) / 365.0 ) );
587 RETURN_FINITE( fRet
);
591 double SAL_CALL
AnalysisAddIn::getIntrate( constREFXPS
& xOpt
,
592 sal_Int32 nSettle
, sal_Int32 nMat
, double fInvest
, double fRedemp
, const ANY
& rOB
) THROWDEF_RTE_IAE
594 if( fInvest
<= 0.0 || fRedemp
<= 0.0 || nSettle
>= nMat
)
597 double fRet
= ( ( fRedemp
/ fInvest
) - 1.0 ) / GetYearDiff( GetNullDate( xOpt
), nSettle
, nMat
, getDateMode( xOpt
, rOB
) );
598 RETURN_FINITE( fRet
);
602 double SAL_CALL
AnalysisAddIn::getCoupncd( constREFXPS
& xOpt
,
603 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
605 double fRet
= GetCoupncd( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
606 RETURN_FINITE( fRet
);
610 double SAL_CALL
AnalysisAddIn::getCoupdays( constREFXPS
& xOpt
,
611 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
613 double fRet
= GetCoupdays( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
614 RETURN_FINITE( fRet
);
618 double SAL_CALL
AnalysisAddIn::getCoupdaysnc( constREFXPS
& xOpt
,
619 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
621 double fRet
= GetCoupdaysnc( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
622 RETURN_FINITE( fRet
);
626 double SAL_CALL
AnalysisAddIn::getCoupdaybs( constREFXPS
& xOpt
,
627 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
629 double fRet
= GetCoupdaybs( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
630 RETURN_FINITE( fRet
);
634 double SAL_CALL
AnalysisAddIn::getCouppcd( constREFXPS
& xOpt
,
635 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
637 double fRet
= GetCouppcd( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
638 RETURN_FINITE( fRet
);
642 double SAL_CALL
AnalysisAddIn::getCoupnum( constREFXPS
& xOpt
,
643 sal_Int32 nSettle
, sal_Int32 nMat
, sal_Int32 nFreq
, const ANY
& rOB
) THROWDEF_RTE_IAE
645 double fRet
= GetCoupnum( GetNullDate( xOpt
), nSettle
, nMat
, nFreq
, getDateMode( xOpt
, rOB
) );
646 RETURN_FINITE( fRet
);
650 double SAL_CALL
AnalysisAddIn::getFvschedule( double fPrinc
, const SEQSEQ( double )& rSchedule
) THROWDEF_RTE_IAE
652 ScaDoubleList aSchedList
;
654 aSchedList
.Append( rSchedule
);
656 for( const double* p
= aSchedList
.First() ; p
; p
= aSchedList
.Next() )
659 RETURN_FINITE( fPrinc
);
663 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */