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()
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).
Eike
--
OOo Calc core developer. Number formatter stricken i18n transpositionizer.
Signature key 0x87F8D412 : 2F58 5236 DB02 F335 8304 7D6C 65C9 F9B5 87F8 D412
OpenOffice.org Engineering at Oracle: http://blogs.sun.com/GullFOSS
--
Please don't send mail to the old [email protected] account that I used for mailing
lists, it will phase out shortly. Use [email protected] instead. Thanks.
pgpukvFsVzWOB.pgp
Description: PGP signature
