diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2016-06-22 17:42:22 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-28 14:51:42 +0000 |
commit | 67188d0e552c9dc50905f7f693d2bb24751a11c5 (patch) | |
tree | b657d0d74fbd6c398459d29d383d53dc37b8db73 /scaddins | |
parent | tdf#100523 Add constraints for AMORDEGRC function. (diff) | |
download | core-67188d0e552c9dc50905f7f693d2bb24751a11c5.tar.gz core-67188d0e552c9dc50905f7f693d2bb24751a11c5.zip |
tdf#100528 Add constraints for AMORLINC function
Function returned different results than Excel does because of missing constraints.
Added constraints are all defined in ODFF1.2 for AMORLINC.
Change-Id: Icd5f9de9cf252e6864e3aa9b47346f6f75669c92
Reviewed-on: https://gerrit.libreoffice.org/26572
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'scaddins')
-rw-r--r-- | scaddins/source/analysis/financial.cxx | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx index 8ad0ebb2ced9..052f8b564525 100644 --- a/scaddins/source/analysis/financial.cxx +++ b/scaddins/source/analysis/financial.cxx @@ -40,7 +40,8 @@ double SAL_CALL AnalysisAddIn::getAmorlinc( const css::uno::Reference< css::bean double fCost, sal_Int32 nDate, sal_Int32 nFirstPer, double fRestVal, double fPer, double fRate, const css::uno::Any& rOB ) throw( css::uno::RuntimeException, css::lang::IllegalArgumentException, std::exception ) { - if( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost ) + if ( nDate > nFirstPer || fRate <= 0.0 || fRestVal > fCost || + fCost <= 0.0 || fRestVal < 0 || fPer < 0 ) throw css::lang::IllegalArgumentException(); double fRet = GetAmorlinc( GetNullDate( xOpt ), fCost, nDate, nFirstPer, fRestVal, fPer, fRate, getDateMode( xOpt, rOB ) ); |