This is an automated email from the ASF dual-hosted git repository.

damjan pushed a commit to branch odf-1.3
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit e172229456487b113132e6d03d331cba42792c7f
Author: Damjan Jovanovic <dam...@apache.org>
AuthorDate: Tue Jan 16 18:08:18 2024 +0200

    In ODF 1.3, the RECEIVED function has a new constraint: Settlement < 
Maturity.
    
    Implement this constraint on our RECEIVED function.
    
    Patch by: me
---
 main/scaddins/source/analysis/financial.cxx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/scaddins/source/analysis/financial.cxx 
b/main/scaddins/source/analysis/financial.cxx
index 00d2cc111d..be13bf5210 100644
--- a/main/scaddins/source/analysis/financial.cxx
+++ b/main/scaddins/source/analysis/financial.cxx
@@ -81,7 +81,7 @@ double SAL_CALL AnalysisAddIn::getAccrintm( constREFXPS& xOpt,
 double SAL_CALL AnalysisAddIn::getReceived( constREFXPS& xOpt,
        sal_Int32 nSettle, sal_Int32 nMat, double fInvest, double fDisc, const 
ANY& rOB ) THROWDEF_RTE_IAE
 {
-       if( fInvest <= 0.0 || fDisc <= 0.0 )
+       if( fInvest <= 0.0 || fDisc <= 0.0 || nSettle >= nMat )
                THROW_IAE;
 
     double fRet = fInvest / ( 1.0 - ( fDisc * GetYearDiff( GetNullDate( xOpt 
), nSettle, nMat, getDateMode( xOpt, rOB ) ) ) );

Reply via email to