summaryrefslogtreecommitdiff
path: root/scaddins
diff options
context:
space:
mode:
authorWinfried Donkers <winfrieddonkers@libreoffice.org>2017-05-03 16:12:50 +0200
committerEike Rathke <erack@redhat.com>2017-05-04 23:55:35 +0200
commit87a5be1cb579cb1e215c39990986c0a770c18b50 (patch)
tree5520d9e903b31267773828b535da5aac68d5f219 /scaddins
parentad711bc6e2cc35c2ed114fff15008d5bbcfcf21c (diff)
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 <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'scaddins')
-rw-r--r--scaddins/source/analysis/financial.cxx2
1 files changed, 1 insertions, 1 deletions
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 ) );