Version: unknown (using KDE 3.5.4 "release 78.1" , openSUSE ) Compiler: Target: i586-suse-linux OS: Linux (i686) release 2.6.13-15.7-default KSpread 1.5.2 from SuSE rpms Try this (lvalues are spreadsheet cell names) A1 = 100000 B1 = .06/12 C1 = 360 D1 = -(pmt(b1;c1;a1) A3 = 1 B3 = A1 C3 = $B$1*B3 D3 = $D$1 - C3 A4 = A4 + 1 B4 = B3 - D3 copy C3:D3 and paste to C4 now copy A4:D4 and paste into a range of rows - A5:A363 would be ideal, but 16 rows seems sufficient (4 or 8 will work). Depending on how long you wait (OO.o will do 360 rows in a second or less - exact same cell contents and copy/paste) either KSpread will lock up, KDE will crash, or it will take down the entire machine. Also, why is it necessary to use parens to apply a unary minus to the pmt function? The description above will generate a home mortgage loan amortization table for a 30 year mortgage - it shows how much you owe (in column B) for each monthly payment.
SVN commit 593478 by ariya: fixed wrong handling of unary operator before a function CCBUG: 135131 M +4 -2 formula.cc M +9 -0 tests/formula_tester.cc --- branches/koffice/1.6/koffice/kspread/formula.cc #593477:593478 @@ -1070,10 +1070,11 @@ } // rule for unary operator: (op1) (op2) X -> (op1) X - // conditions: op2 is unary + // conditions: op2 is unary, token is not '(' // action: push (op2) to result // e.g. "* - 2" becomes "*" if( !ruleFound ) + if( token.asOperator() != Token::LeftPar ) if( syntaxStack.itemCount() >= 3 ) { Token x = syntaxStack.top(); @@ -1095,9 +1096,10 @@ } // auxilary rule for unary operator: (op) X -> X - // conditions: op is unary, op is first in syntax stack + // conditions: op is unary, op is first in syntax stack, token is not '(' // action: push (op) to result if( !ruleFound ) + if( token.asOperator() != Token::LeftPar ) if( syntaxStack.itemCount() == 2 ) { Token x = syntaxStack.top(); --- branches/koffice/1.6/koffice/kspread/tests/formula_tester.cc #593477:593478 @@ -241,7 +241,16 @@ CHECK_EVAL( "5---1", Value(4) ); CHECK_EVAL( "5----1", Value(6) ); CHECK_EVAL( "5-----1", Value(4) ); + CHECK_EVAL( "5-----1*2.5", Value(2.5) ); + CHECK_EVAL( "5------1*2.5", Value(7.5) ); CHECK_EVAL( "-SIN(0)", Value(0) ); + CHECK_EVAL( "1.1-SIN(0)", Value(1.1) ); + CHECK_EVAL( "1.2--SIN(0)", Value(1.2) ); + CHECK_EVAL( "1.3---SIN(0)", Value(1.3) ); + CHECK_EVAL( "-COS(0)", Value(-1) ); + CHECK_EVAL( "1.1-COS(0)", Value(0.1) ); + CHECK_EVAL( "1.2--COS(0)", Value(2.2) ); + CHECK_EVAL( "1.3---COS(0)", Value(0.3) ); // no parentheses, checking operator precendences CHECK_EVAL( "14+3*77", Value(245) );
See also bug 59510 comment 17 ; somewhat related.
*** Bug has been marked as fixed ***.
You need to log in before you can comment on or make changes to this bug.