ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <ste...@apache.org>
Subject Re: cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs/condition XorTest.java
Date Tue, 25 Jan 2005 21:28:35 GMT
Matt Benson wrote:
> --- Dominique Devienne <DDevienne@lgc.com> wrote:
> [SNIP]
> 
>>I find the >2 conditions case weird. Is that usual
>>to extend
> 
> [SNIP]
> 
>>Am I the only one who thinks that way? I guess I've
>>never run
>>across an XOR conditional with more than 2
>>operands... --DD
> 
> 
> DD, I would have thought so too, but I googled for
> "xor" and the first hit was:
> 
> http://mathworld.wolfram.com/XOR.html
> 
> Which says, among other things:
> 
> (quote)
> For multiple arguments, XOR is defined to be true if
> an odd number of its arguments are true, and false
> otherwise. This definition is quite common in computer
> science, where XOR is usually thought of as addition
> modulo 2. In this context, it arises in polynomial
> algebra modulo 2, arithmetic circuits with a full
> adder, and in parity generating or checking. While
> this means that the multiargument "XOR" can no longer
> be thought of as "the exclusive OR" operation, this
> form is rarely used in mathematical logic and so does
> not cause very much confusion.
> (end quote)
> 
> I guess we learned something today.  ;)
> 
> -Matt

Consider yourselves enlightened :)

I didn't know about the formal definition either, it was just the <and> 
and <or> tasks worked on >2 elements, so I added the same code to the 
xor thing by chaining the (associative) operation. The outcome of the 
chain (true for an odd number of true inputs) is what you get when you 
start off with an initial value (false) that works for the first two inputs.

-steve


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message