Bug 150019 - ACCRINT result is wrong when basis is 1
Summary: ACCRINT result is wrong when basis is 1
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.3 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2022-07-16 17:29 UTC by larry.ellis
Modified: 2024-07-28 03:15 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Spreadsheet example (44.13 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-07-16 17:35 UTC, larry.ellis
Details

Note You need to log in before you can comment on or make changes to this bug.
Description larry.ellis 2022-07-16 17:29:15 UTC
Description:
When the Basis parameter is 1, the result from ACCRINT does not match the formula.  If the same ACCRINT values are used in Excel, the result DOES match the formula.  I conclude ACCRINT is not functioning properly.

Steps to Reproduce:
Enter the following formula: =ACCRINT("2001-2-28","2001-08-31","2001-05-01",10%,1500,2,1)

Actual Results:
25.479452

Expected Results:
25.271739

This results from the following formula in your documentation: 

Rate * (Par/Frequency) * (DaysOfInterestEarned/DaysInPaymentPeriod)

Rate = .10
Par = 1500
Frequency = 2
DaysOfInterestEarned = 62       (Settlement - Issue)
DaysInPaymentPeriod = 184       (FirstInterest - Issue)

ACCRINT = .10 * (1500/2) * (62/184)
ACCRINT = 25.271739



Reproducible: Always


User Profile Reset: No



Additional Info:
I believe this is not a new bug, I am sure it existed in early 7.x releases and possibly all Libre Calc releases.  But, my help/about information is:

Version for testing 7.3.4.2 (x64) 
Build: 728fec
Comment 1 larry.ellis 2022-07-16 17:35:25 UTC
Created attachment 181290 [details]
Spreadsheet example

The attached spreadsheet also demonstrates the bug, or use comments to reproduce.
Comment 2 raal 2022-07-17 12:32:37 UTC
I can confirm with Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a) and Version: 7.5.0.0.alpha0+ / LibreOffice Community
Build ID: 11937a68aecb8db9aebb1c929d940c5b85a0ecec
CPU threads: 4; OS: Linux 5.13; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded

Result in excel and google office is 25,27. Try to change B16 in attached file to 182.5 and you'll get result as in LO, so LO calculate Dazs in period as 182.5. Setting to New.
Comment 3 Julien Nabet 2022-07-27 13:58:12 UTC
On pc Debian x86-64 with master sources updated today, I noticed this on gdb on the frame
ScUnoAddInCall::ExecuteCallWithArgs (this=0x7ffe39f02b28, rCallArgs=uno::Sequence of length 8 = {...}) at sc/source/core/tool/addincol.cxx:1399

$1 = uno::Sequence of length 8 = {uno::Any("com.sun.star.uno.XInterface": {_vptr$XInterface = 0x34425c0}), uno::Any("long": 36950), uno::Any("long": 37134), uno::Any("long": 37012), 
  uno::Any("double": 0.10000000000000001), uno::Any("double": 1500), uno::Any("long": 2), uno::Any("double": 1)}

fRate should be just 0.1

here's more of the bt:
#0  AnalysisAddIn::getAccrint(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&, int, int, int, double, com::sun::star::uno::Any const&, int, com::sun::star::uno::Any const&)
    (this=0x36a5a50, xOpt=uno::Reference to (ScModelObj *) 0x34427f8, nIssue=36950, nSettle=37012, fRate=0.10000000000000001, rVal=uno::Any("double": 1500), nFreq=2, rOB=uno::Any("double": 1))
    at scaddins/source/analysis/financial.cxx:57
#1  0x00007fcc680c8df0 in non-virtual thunk to AnalysisAddIn::getAccrint(com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> const&, int, int, int, double, com::sun::star::uno::Any const&, int, com::sun::star::uno::Any const&) () at scaddins/source/analysis/financial.cxx:62
#2  0x00007fcc75f2ec91 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*)
    (pThis=0x36a5ab0, nVtableIndex=69, pRegisterReturn=0x7ffe39f01ee0, pReturnTypeRef=0x10889f0, bSimpleReturn=true, pStack=0x7ffe39f018e0, nStack=2, pGPR=0x7ffe39f01c20, pFPR=0x7ffe39f01be0)
    at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77
#3  0x00007fcc75f2d86c in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) (pThis=0x88cc450, aVtableSlot=..., pReturnTypeRef=0x10889f0, nParams=8, pParams=0x36b9ce0, pUnoReturn=0x7ffe39f01ee0, pUnoArgs=0x7ffe39f01e60, ppUnoExc=0x7ffe39f021d0)
    at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233
#4  0x00007fcc75f2cfc8 in unoInterfaceProxyDispatch(uno_Interface*, typelib_TypeDescription const*, void*, void**, uno_Any**)
    (pUnoI=0x88cc450, pMemberDescr=0x36b9bf0, pReturn=0x7ffe39f01ee0, pArgs=0x7ffe39f01e60, ppException=0x7ffe39f021d0) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413
#5  0x00007fcc68a97f3a in stoc_corefl::(anonymous namespace)::IdlInterfaceMethodImpl::invoke(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&)
       (this=0x36cff90, rObj=uno::Any("com.sun.star.sheet.XAddIn": {<com::sun::star::lang::XLocalizable> = {<com::sun::star::uno::XInterface> = {_vptr$XInterface = 0x36a5aa0}, <No data fields>}, <No data fields>}), rArgs=uno::Sequence of length 8 = {...}) at stoc/source/corereflection/criface.cxx:672
#6  0x00007fcc68a98a07 in non-virtual thunk to stoc_corefl::(anonymous namespace)::IdlInterfaceMethodImpl::invoke(com::sun::star::uno::Any const&, com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) ()
    at stoc/source/corereflection/criface.cxx:566
#7  0x00007fcc6cf03569 in ScUnoAddInCall::ExecuteCallWithArgs(com::sun::star::uno::Sequence<com::sun::star::uno::Any>&) (this=0x7ffe39f02b28, rCallArgs=uno::Sequence of length 8 = {...})
    at sc/source/core/tool/addincol.cxx:1399
#8  0x00007fcc6cf03392 in ScUnoAddInCall::ExecuteCall() (this=0x7ffe39f02b28) at sc/source/core/tool/addincol.cxx:1373
#9  0x00007fcc6d11f953 in ScInterpreter::ScExternal() (this=0x89d0210) at sc/source/core/tool/interpr4.cxx:3033
#10 0x00007fcc6d1289eb in ScInterpreter::Interpret() (this=0x89d0210) at sc/source/core/tool/interpr4.cxx:4435
#11 0x00007fcc6cd28404 in ScFormulaCell::InterpretTail(ScInterpreterContext&, ScFormulaCell::ScInterpretTailParameter) (this=0x67a9560, rContext=..., eTailParam=ScFormulaCell::SCITP_NORMAL)
    at sc/source/core/data/formulacell.cxx:1945
#12 0x00007fcc6cd261f0 in ScFormulaCell::Interpret(int, int) (this=0x67a9560, nStartOffset=-1, nEndOffset=-1) at sc/source/core/data/formulacell.cxx:1618
#13 0x00007fcc6c95e983 in lcl_EvalDirty(mdds::mtv::soa::multi_type_vector<mdds::mtv::custom_block_func3<mdds::mtv::default_element_block<52, svl::SharedString>, mdds::mtv::noncopyable_managed_element_block<53, EditTextObject>, mdds::mtv::noncopyable_managed_element_block<54, ScFormulaCell> >, sc::CellStoreTrait>&, int, int, ScDocument&, boost::intrusive_ptr<ScFormulaCellGroup> const&, bool, bool, bool&, bool&)
     (rCells=..., nRow1=17, nRow2=18, rDoc=..., mxGroup=..., bThreadingDepEval=false, bSkipRunning=true, bIsDirty=@0x7ffe39f047a7: true, bAllowThreading=@0x7ffe39f047a6: false)
    at sc/source/core/data/column4.cxx:1933
#14 0x00007fcc6c95e155 in ScColumn::EnsureFormulaCellResults(int, int, bool) (this=0x6780880, nRow1=17, nRow2=18, bSkipRunning=true) at sc/source/core/data/column4.cxx:1989
#15 0x00007fcc6cee5645 in ScTable::EnsureFormulaCellResults(short, int, short, int, bool) (this=0x347d040, nCol1=1, nRow1=17, nCol2=1, nRow2=18, bSkipRunning=true) at sc/source/core/data/table7.cxx:444
#16 0x00007fcc6cb02efb in ScDocument::EnsureFormulaCellResults(ScRange const&, bool) (this=0x3431260, rRange=..., bSkipRunning=true) at sc/source/core/data/document10.cxx:1010
Comment 4 QA Administrators 2024-07-28 03:15:12 UTC
Dear larry.ellis,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug