Hello Eike,

Eike Rathke schrieb:
Hi Regina,

Sorry for not having answered your previous mail about whether someone
was already working on LINEST. No one is. Thanks for taking that.

On Tuesday, 2010-08-03 20:27:56 +0200, Regina Henschel wrote:

the draft ODF1.2 spec defines the syntax
LINEST( Array knownY [ ; [ Array knownX ] [ ; Logical Const = TRUE()
[ ; Logical Stats = FALSE() ] ] ] )

With this syntax the formula
=LINEST(B2:B6;A2:A6;;TRUE())
is not allowed, but currently it gives no error (That is issue106118).

The interpreter allows these cases because in Excel the missing
parameter is allowed at most places and that's needed for imported
documents. When writing to ODFF we'd need to handle that in
formula/source/core/api/token.cxx methods
MissingConvention::isRewriteNeeded() and
FormulaMissingContext::AddMissing()

I think, that the interpreter should not allow invalid (in respect to ODF) formulas, but complain about wrong syntax. Instead the import filter should add the missing parameter. The third parameter has an ODF default value "true" and Excel calculates with this missing parameter as if it is "true". Therefore the Excel import filter should add a "true". Issue 106118 is about the fact, that our interpreter does not default to "true" but to "false". From a technical view it is no problem to set it to "true" in the LINEST method, but I think it would be the wrong way.


For ODFF there may be a general approach necessary that normally
rewrites a missing parameter and allows missing parameters only for
specific functions and parameters. Best approach probably would be to
have a table of OpCodes and parameters. This should not be your concern
now, we'll have to do that later though.


And the formula
=LINEST(B2:B6;;TRUE();TRUE())
is allowed, but currently gives an error.

I have tried to detect this cases using the method IsMissing():
In interpr5.cxx
[...]
     if (nParamCount>= 2)
     {// In ODF1.2 empty second parameter is allowed
         if (IsMissing())
         {
             Pop();
             pMatX = NULL;
         }
         else
             pMatX = GetMatrix();
     }

The method IsMissing() works so far, that the then-case is reached.
But I get an error popup
        ConvertMatrixParameters: not a push
        From File C:/DEV300m84my/sc/source/core/tool/interpr4.cxx at Line 1444

ConvertMatrixParameters() isn't prepared for missings.. at line 1442
change

         if ( p->GetOpCode() != ocPush )

to

         if ( p->GetOpCode() != ocPush&&  p->GetOpCode() != ocMissing )

that should do (untested).

I have changed it and it works for the LINEST method. Is this a valid solution or might it breaks something in other places?

Kind regards
Regina

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@sc.openoffice.org
For additional commands, e-mail: dev-h...@sc.openoffice.org

Reply via email to