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

New commits:
commit 87a5be1cb579cb1e215c39990986c0a770c18b50
Author: Winfried Donkers <winfrieddonk...@libreoffice.org>
Date:   Wed May 3 16:12:50 2017 +0200

    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 <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>

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 ) );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to