diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2016-06-22 17:38:42 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-06-28 14:49:36 +0000 |
commit | e227b6516295c6954d24a8eb67d2f0c0475c32e9 (patch) | |
tree | 2018c266e7a8ab9f0879ee0c143286012e69747e /scaddins | |
parent | 0ffe9eb48a78bccf3d01a0effd5f2715174d38ff (diff) |
tdf#100523 Add constraints for AMORDEGRC function.
Function returned different results than Excel does because of missing constraints.
Change-Id: Iea8424a8429e0c48a19fe2818ca4be26c90afd32
Reviewed-on: https://gerrit.libreoffice.org/26571
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 c51f4e984de8..8ad0ebb2ced9 100644 --- a/scaddins/source/analysis/financial.cxx +++ b/scaddins/source/analysis/financial.cxx @@ -27,7 +27,8 @@ double SAL_CALL AnalysisAddIn::getAmordegrc( const css::uno::Reference< css::bea 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 = GetAmordegrc( GetNullDate( xOpt ), fCost, nDate, nFirstPer, fRestVal, fPer, fRate, getDateMode( xOpt, rOB ) ); |