https://bugs.kde.org/show_bug.cgi?id=503863
--- Comment #1 from Johannes <joha4...@gmail.com> --- I was poking around in the source code, it seems like the sequence of events leading to the bug is: 1. Expression starting with - is encountered, and a leading zero is inserted to make the binary - operator happy (in `CalcEngine::calculate()` 2. Expression is evaluated backwards in `CalcEngine::reduce_Stack_` I'm happy to submit a patch fixing it, but after debugging a little the right solution was no longer obvious. I see two possible approaches: 1: Further modify the special case handling of first token being a `TokenCode::MINUS` in `CalcEngine::calculate()` to ensure -number is always parsed as (-number). Which I think requires keeping state across iterations... which seems somewhat distasteful 2: Rewrite `CalcEngine` to support operators precedence and handle operators that can both be binary and unary. What I think is the _right_ solution and I'm happy to do so, but its a major refactor for a random drive-by patch. I'm happy to do implement either (or just leave the problem for somebody else), but I need somebody to point me in the right direction first. -- You are receiving this mail because: You are watching all bug changes.