Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


Hi Winfried,

On Thursday, 2015-01-29 10:15:59 +0100, Winfried Donkers wrote:

I am working on bug 88576, regarding IFERROR and IFNA not giving expected results when not all 
mandatory arguments are given.
On checking their behaviour in various cases, I discovered that IFERROR, IFNA and IF do not 
handle empty arguments as they should be.
With empty argument I mean e.g. -IFERROR(something;) of IF(statement;;argument).
With IFERROR and IFNA these situation should return an empty value to be compatible with Excel.

AFAIK also Excel does not allow a null argument for IFERROR() second
parameter, but I'm not sure, I'd have to check.

With IF, the behaviour is described in ODFF1.2.

Note that there seems to be a typo in the spec, IfFalse is mentioned
twice to be considered to be 0, the first (two consecutive ;; case)
probably should be IfTrue.

My question is, where should this behaviour best be put in the code?
In class FormulaCompiler, e.g. in FormulaCompiler::Factor(), in ScInterpreter::Interpret(), in 
the functions themselves (ScInterpreter::ScIf() and ScInterpreter::ScIfError() or somewhere else?

I think the right place would be ScInterpreter::Interpret() at the end
where the final result is obtained. There's a check

    if( pCur->GetOpCode() == ocPush )

and if not an error is set. An ocMissing here could be propagated
through to the ScFormulaResult, then

    bool isValue( formula::StackVar sv )

in sc/source/core/tool/formularesult.cxx would need to handle
formula::svMissing as well, the ScFormulaResult::GetDouble() already
returns 0.0 in such case.

And as these functions are jump functions, how best to access/modify the stack or FormulaToken?

Don't ;-)
The code is already an ocMissing and the jumps are correct, just the
final result isn't.

  Eike

-- 
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918  630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack

Attachment: pgpheHZBvoIiu.pgp
Description: PGP signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.