Hi Winfried,

On Thursday, 2015-02-05 12:44:56 +0100, Winfried Donkers wrote:

> >> and =IFERROR(1/0;) returns an empty cell, not an error message.
> 
> >This is correct and voids my earlier proposal to propagate the ocMissing 
> >token through in the final result. Actually we need to pop an ocMissing and 
> >push an ScEmptyCellToken in such case.
> 
> (To make it clear for me, =IFERROR(1/0,) results in an empty cell in Excel 
> and an error in Calc.)
> Popping ocMissing seems a bit of a problem - for me ;-) - as 
> ScInterpreter::Interpret calls ScIfError() first and then changes opcode. So, 
> when I detect ocMissing, I don't know from which function.
> In the case of IFERROR I could use a boolean to return an empty cell, but in 
> the case of IF I need to know the result of the expression in the first 
> argument or whether the ocMissing refers to the ifTrue argument or the 
> ifFalse argument.
> I hope you understand my problem.

Yup.. actually the pop/push approach would only work as final result,
not in between on the fly.. So, I tried things in Excel and all these
yield TRUE, meaning that the "empty cell" is preserved as code path:
=IFERROR(1/0,)=""
=IFERROR(1/0,)=0
=IF(1,,)=""
=IF(1,,)=0

We have something similar with formula::svEmptyCell, my rough guess now
is it should be enough to treat svMissing the same as svEmptyCell in
comparisons (ScInterpreter::Compare() and ScInterpreter::CompareMat()),
instead of forcing it into a context of svDouble at that stage, and when
preparing the final result check for an ocMissing (interpr4.cxx line
4371 in Interpret() at "obtain result" before the current if(
pCur->GetOpCode() == ocPush )) and if so pop it and push an empty cell,
i.e. Pop(), PushTempToken( new ScEmptyCellToken( false, false))

Does that clarify?

  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: pgpNgCmi1tHBt.pgp
Description: PGP signature

_______________________________________________
LibreOffice mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to