Version: 2.2 (using KDE 4.5.5)
The description of the XOR function in messages/calligra/tables.pot is:
The XOR() function returns False if the number of True values is even.
Otherwise it returns True. It returns an error if any argument is an error.
A better description would be:
The XOR() function executes per two Boolean parameters, starting at the left,
an XOR, reducing these two parameters to one and repeats that until there is only one result. The function XOR(True;True) = XOR (False;False) = False; XOR(True;False) = XOR(False;True) = True. It returns an error if any argument is an error.
The implementation is wrong.
Entering =XOR(False;True;True;True) in a cell should return True, however it returns False. According to the above description the result should be True if the number of True parameters is uneven. This number is 3, so it should be True. Also the suggested description has True as the outcome of the function.
Steps to Reproduce:
The suggested description is more close to a mathematical oriented user.
Created attachment 59250 [details]
This should fix it (but untested).
Are you serious to produce and release code that you did not test on proper functioning?
The change is a no-brainer, why don't you verify the fix? You reported the bug, so you should know how to trigger it. I have never used calligra-tables, so I don't even know how I can test the XOR function.
I don't know when the new version with the patch arrives in an update to my distribution, openSUSE. It is only at that moment that I can test the change.
Tables is just the new name for KSpread, and it works as a spreadsheet application. To test you only need to enter "=XOR(False;True;True;True)" without the quotes in a cell and observe the outcome; should be True. Add another True as argument and the result should be False, etc.
Git commit e6c0736543820b1fe4a73c89eb1f85284103f8ef by Inge Wallin.
Committed on 03/06/2011 at 16:44.
Pushed by ingwa into branch 'master'.
Fix bug 271251: XOR function has been implemented wrongly
The analysis By Christoph Feck in commnet #1 is spot on, and so was
the attached patch. I just changed it a tiny amount. Thank you very
It's a bit embarrassing that we let this fundamental bug through.
M +2 -2 tables/functions/logic.cpp
I forgot to write: This fix will be in 2.4 snapshot 2, which is released on June 14th according to http://community.kde.org/Calligra/Schedules/2.4/Release_Plan .