[Kst] Equation parser decisions to make
George Staikos
staikos at kde.org
Mon Nov 22 22:26:16 CET 2004
On Monday 22 November 2004 16:08, Barth Netterfield wrote:
> On Monday 22 November 2004 14:39, George Staikos wrote:
> > 1)
> > Test of ()[1.0000000000000000] == 0.0000000000000000 failed.
> >
> > Do we allow empty equations? If so what do they evaluate to? 0?
> > NOPOINT?
>
> We shouldn't allow them. If they happen, NOPOINT sounds good to me.
Well this is a parser question. Do we give a parse error, or do we parse
it as OK and return NOPOINT for all possible evaluations.
> > 2)
> > Result: 0.7540103247897930
> > Test of (asin(sin(x)))[2.3875823288000002] == 2.3875823288000002 failed.
>
> Phase -> asin is multi-valued.
> sin(2.3875823288000002) = 0.68456758087715
> sin(0.7540103247897930) = 0.68456758087715
> Plot sin(x) from -10 to 10 to see the effect.
>
> kst is doing the correct thing here - the test is bad.
ARGH I had kcalc in degree mode instead of radian. Of course. (I did
think of this phase issue but didn't dig into it too deply when kcalc seemed
to do it without problem.)
> > 4)
> > Result: -1.0000000000000000
> > Test of (-1|257)[0.0000000000000000] == 257.0000000000000000 failed.
> > Result: -1.0000000000000000
> > Test of (257|-1)[0.0000000000000000] == 257.0000000000000000 failed.
> >
> > What do we want the result of bitwise ops with negative numbers to be?
>
> It becomes encoding specific. -1 == 0xffff ffff is a perfectly usual
> definition (true on any arch I know). (2's complement) so I am ok with
> leaving it as is.
Ok.
> > 5)
> > Test of (foo(3,)) parsing passed, but should have failed.
> > Test of (foo(3,,5)) parsing passed, but should have failed.
> >
> > Should we allow empty arguments to functions and plugins? If so, what
> > do we put there?
>
> Empty should be disallowed unless we allow optional parameters (I don't
> think we do).
Turns out we were erroring, but I had error recovery in for this case.
I've since removed it locally. I'll commit that trivial fix with the rest
once approved.
--
George Staikos
KDE Developer http://www.kde.org/
Staikos Computing Services Inc. http://www.staikos.net/
More information about the Kst
mailing list