sc/qa/unit/data/functions/logical/fods/ifs.fods | 27 ++++++++++++++++++++++++ svl/qa/unit/svl.cxx | 5 ++++ svl/source/numbers/zformat.cxx | 10 ++++---- 3 files changed, 37 insertions(+), 5 deletions(-)
New commits: commit 4368272648f7264d4a2884db80bf5a100ab9d8ca Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 27 10:57:03 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Jan 27 13:53:23 2026 +0100 tdf#167892: svl_qa_cppunit: Add test Change-Id: I56925b648518c8e3399e534e3c82eb9bc0bfa335 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198192 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 0ea8c093af66..bcaaf25ec2a8 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -1437,6 +1437,11 @@ void Test::testUserDefinedNumberFormats() sExpected = "-1/2"; checkPreviewString(aFormatter, sCode, -0.5, eLang, sExpected); } + { // tdf#167892: hang formatting as fraction + sCode = "#/?"; + sExpected = "0/1"; + checkPreviewString(aFormatter, sCode, 0.0000000000000000001, eLang, sExpected); + } { // tdf#52510 sCode = "_($* #,##0.00_);_($* (#,##0.00);"; sExpected = ""; diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index 8253bd4e9429..1495762b3391 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -2884,14 +2884,14 @@ void SvNumberformat::ImpGetFractionElements ( double& fNumber, sal_uInt16 nIx, { double fTemp = 1.0 / fRemainder; // 64bits precision required when fRemainder is very weak nPartialDenom = static_cast<sal_Int64>(floor(fTemp)); // due to floating point notation with double precision -#ifdef _WIN32 // The fTemp value may be out of range for sal_Int64 (e.g. 1e+19), and the result of - // casting that is undefined. In practice, gcc/llvm gives us a large positive number, but MSVC may create - // a large negative number, which will make this algorithm oscillate, so apply a correction that makes - // MSVC end up with the same thing. There is probably a better algorithm to be used here. + // casting that is undefined. In practice, gcc/llvm gives us a large positive number, + // but depending on the compiler, we have either a large positive number (which works fine) + // or a a large negative number, which will make this algorithm oscillate. + // So apply a correction that makes all the compilers work reasonbly. + // There is probably a better algorithm to be used here for this whole function. if (nPartialDenom < 0) nPartialDenom = -(nPartialDenom+1); -#endif fRemainder = fTemp - static_cast<double>(nPartialDenom); nDivNext = nPartialDenom * nDiv + nDivPrev; if (nDivNext <= nBasis) // continue loop commit 54925c7e7b750e2965a79e2bfae3270801c4c60b Author: Xisco Fauli <[email protected]> AuthorDate: Tue Jan 27 12:15:45 2026 +0100 Commit: Xisco Fauli <[email protected]> CommitDate: Tue Jan 27 13:53:08 2026 +0100 tdf#124710: sc_logical_functions_test: Add test Change-Id: I2aa430f0508a60dc1ec0ca6b0065b4c10374fa12 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198194 Tested-by: Jenkins Reviewed-by: Xisco Fauli <[email protected]> diff --git a/sc/qa/unit/data/functions/logical/fods/ifs.fods b/sc/qa/unit/data/functions/logical/fods/ifs.fods index 23a98aa78480..8f17d6d146e4 100644 --- a/sc/qa/unit/data/functions/logical/fods/ifs.fods +++ b/sc/qa/unit/data/functions/logical/fods/ifs.fods @@ -3848,6 +3848,33 @@ <table:table-cell table:style-name="ce11" table:number-columns-repeated="4"/> <table:table-cell table:number-columns-repeated="2"/> </table:table-row> + <table:table-row table:style-name="ro2"> + <table:table-cell table:style-name="ce69" table:formula="of:=COM.MICROSOFT.IFS( 0; NA(); 1+0; "no idea")" office:value-type="string" office:string-value="no idea" calcext:value-type="string"> + <text:p>no idea</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce69" office:value-type="string" calcext:value-type="string"> + <text:p>no idea</text:p> + </table:table-cell> + <table:table-cell table:style-name="ce73" table:formula="of:=[.A17]=[.B17]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <text:p></text:p> + </table:table-cell> + <table:table-cell table:style-name="ce76" table:formula="of:=FORMULA([.A17])" office:value-type="string" office:string-value="" calcext:value-type="string"> + <text:p></text:p> + </table:table-cell> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce71"/> + <table:table-cell table:style-name="ce81"/> + <table:table-cell/> + <table:table-cell table:style-name="ce84" table:number-columns-repeated="2"/> + <table:table-cell table:style-name="ce81"/> + <table:table-cell table:style-name="ce86"/> + <table:table-cell/> + <table:table-cell table:style-name="ce11" table:number-columns-repeated="2"/> + <table:table-cell table:number-columns-repeated="3"/> + <table:table-cell table:style-name="ce86"/> + <table:table-cell table:style-name="ce11" table:number-columns-repeated="4"/> + <table:table-cell table:number-columns-repeated="2"/> + </table:table-row> <table:table-row table:style-name="ro5" table:number-rows-repeated="4"> <table:table-cell table:style-name="science"/> <table:table-cell table:style-name="ce69"/>
