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

New commits:
commit e227b6516295c6954d24a8eb67d2f0c0475c32e9
Author: Winfried Donkers <winfrieddonk...@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 <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@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 ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to