[Libreoffice-commits] core.git: scaddins/source

Winfried Donkers winfrieddonkers at libreoffice.org
Tue Jun 28 14:52:11 UTC 2016


 scaddins/source/analysis/financial.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 67188d0e552c9dc50905f7f693d2bb24751a11c5
Author: Winfried Donkers <winfrieddonkers at libreoffice.org>
Date:   Wed Jun 22 17:42:22 2016 +0200

    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 at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx
index 8ad0ebb..052f8b5 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 ) );


More information about the Libreoffice-commits mailing list