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>
This commit is contained in:
Winfried Donkers
2016-06-22 17:42:22 +02:00
committed by Eike Rathke
parent e227b65162
commit 67188d0e55

View File

@@ -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 ) );