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

Winfried Donkers winfrieddonkers at libreoffice.org
Tue Jun 28 14:50:03 UTC 2016


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

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

    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 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 c51f4e9..8ad0ebb 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 ) );


More information about the Libreoffice-commits mailing list