<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>271251</bug_id>
          
          <creation_ts>2011-04-18 23:27:16 +0000</creation_ts>
          <short_desc>XOR function has been implemented wrongly</short_desc>
          <delta_ts>2011-06-03 16:50:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>calligrasheets</product>
          <component>general</component>
          <version>2.2</version>
          <rep_platform>openSUSE</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>0</everconfirmed>
          <reporter name="Freek de Kruijf">freekdekruijf</reporter>
          <assigned_to name="Calligra Sheets (KSpread) Bugs">calligra-sheets-bugs-null</assigned_to>
          <cc>inge</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1109303</commentid>
    <comment_count>0</comment_count>
    <who name="Freek de Kruijf">freekdekruijf</who>
    <bug_when>2011-04-18 23:27:16 +0000</bug_when>
    <thetext>Version:           2.2 (using KDE 4.5.5) 
OS:                Linux

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.

Reproducible: Always

Steps to Reproduce:
See above.

Actual Results:  
False

Expected Results:  
True

The suggested description is more close to a mathematical oriented user.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1110706</commentid>
    <comment_count>1</comment_count>
      <attachid>59250</attachid>
    <who name="Christoph Feck">cfeck</who>
    <bug_when>2011-04-23 19:15:52 +0000</bug_when>
    <thetext>Created attachment 59250
XOR fix

This should fix it (but untested).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1110753</commentid>
    <comment_count>2</comment_count>
    <who name="Freek de Kruijf">freekdekruijf</who>
    <bug_when>2011-04-23 21:40:52 +0000</bug_when>
    <thetext>Are you serious to produce and release code that you did not test on proper functioning?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1111039</commentid>
    <comment_count>3</comment_count>
    <who name="Christoph Feck">cfeck</who>
    <bug_when>2011-04-24 18:54:58 +0000</bug_when>
    <thetext>The change is a no-brainer, why don&apos;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&apos;t even know how I can test the XOR function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1111527</commentid>
    <comment_count>4</comment_count>
    <who name="Freek de Kruijf">freekdekruijf</who>
    <bug_when>2011-04-26 09:24:38 +0000</bug_when>
    <thetext>I don&apos;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 &quot;=XOR(False;True;True;True)&quot; 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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1126723</commentid>
    <comment_count>5</comment_count>
    <who name="Inge Wallin">inge</who>
    <bug_when>2011-06-03 16:48:12 +0000</bug_when>
    <thetext>Git commit e6c0736543820b1fe4a73c89eb1f85284103f8ef by Inge Wallin.
Committed on 03/06/2011 at 16:44.
Pushed by ingwa into branch &apos;master&apos;.

Fix bug 271251: XOR function has been implemented wrongly

BUG:271251

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
much.

It&apos;s a bit embarrassing that we let this fundamental bug through.

M  +2    -2    tables/functions/logic.cpp     

http://commits.kde.org/calligra/e6c0736543820b1fe4a73c89eb1f85284103f8ef</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1126724</commentid>
    <comment_count>6</comment_count>
    <who name="Inge Wallin">inge</who>
    <bug_when>2011-06-03 16:50:23 +0000</bug_when>
    <thetext>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 .</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>59250</attachid>
            <date>2011-04-23 19:15:52 +0000</date>
            <delta_ts>2011-04-23 19:15:52 +0000</delta_ts>
            <desc>XOR fix</desc>
            <filename>tables.diff</filename>
            <type>text/plain</type>
            <size>812</size>
            <attacher name="Christoph Feck">cfeck</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL3RhYmxlcy9mdW5jdGlvbnMvbG9naWMuY3BwIGIvdGFibGVzL2Z1bmN0aW9u
cy9sb2dpYy5jcHAKaW5kZXggY2U0N2E4NC4uY2EyZDBhZiAxMDA2NDQKLS0tIGEvdGFibGVzL2Z1
bmN0aW9ucy9sb2dpYy5jcHAKKysrIGIvdGFibGVzL2Z1bmN0aW9ucy9sb2dpYy5jcHAKQEAgLTI2
MCw3ICsyNjAsNyBAQCBWYWx1ZSBmdW5jX3RydWUodmFsVmVjdG9yLCBWYWx1ZUNhbGMgKiwgRnVu
Y0V4dHJhICopCiAvLwogVmFsdWUgZnVuY194b3I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