From 87a5be1cb579cb1e215c39990986c0a770c18b50 Mon Sep 17 00:00:00 2001 From: Winfried Donkers Date: Wed, 3 May 2017 16:12:50 +0200 Subject: tdf#107566 adjust constraints for Add-In function YIELDMAT. Constraints are adjusted to make Calc behave the same as Excel. Constraint for rate is less severe than ODFF1.2, but a rate of 0 is mathematically no problem and Excel allows a rate of 0. Constraint that Settlement date cannot be before Issue date is neither mentioned in ODFF1.2 nor in Excel's help text for YIELDMAT, but is applied by Excel. In reality, a settlement before issue is not possible. Change-Id: I9c19d33abe8518311606fcee1c9dea32438d61a4 Reviewed-on: https://gerrit.libreoffice.org/37206 Tested-by: Jenkins Reviewed-by: Eike Rathke --- scaddins/source/analysis/financial.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scaddins/source/analysis/financial.cxx b/scaddins/source/analysis/financial.cxx index 70cc6e37a5e5..d5ad25e6dbb4 100644 --- a/scaddins/source/analysis/financial.cxx +++ b/scaddins/source/analysis/financial.cxx @@ -333,7 +333,7 @@ double SAL_CALL AnalysisAddIn::getYielddisc( const css::uno::Reference< css::bea double SAL_CALL AnalysisAddIn::getYieldmat( const css::uno::Reference< css::beans::XPropertySet >& xOpt, sal_Int32 nSettle, sal_Int32 nMat, sal_Int32 nIssue, double fRate, double fPrice, const css::uno::Any& rOB ) { - if( fPrice <= 0.0 || fRate <= 0.0 || nSettle >= nMat ) + if( fPrice <= 0.0 || fRate < 0.0 || nSettle >= nMat || nSettle < nIssue) throw css::lang::IllegalArgumentException(); double fRet = GetYieldmat( GetNullDate( xOpt ), nSettle, nMat, nIssue, fRate, fPrice, getDateMode( xOpt, rOB ) ); -- cgit