Difference between revisions of "BitXOr"

(Created page with "category:Bit functions ''new in Analytica 4.7'' == BitXOr( x'', I'' ) == Returns the bitwise exclusive-OR (XOR) of the integer portions of an array of numbers. Each...")
 
m (4.7 -> 5.0)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[category:Bit functions]]
 
[[category:Bit functions]]
  
''new in [[Analytica 4.7]]''
+
== BitXOr(x'', I'') ==
  
== BitXOr( x'', I'' ) ==
+
Returns the bitwise exclusive-OR (XOR) of the integer portions of an array of numbers. Each bit in the result is on only if the corresponding bit is on in an odd number of integers in «x» along index «I»«I» can be omitted when taking the bitwise XOR across the [[Implicit dimension]].
 
 
Returns the bitwise exclusive-OR (XOR) of the integer portions of an array of numbers. Each bit in the result is on only if the corresponding bit is on in an odd number of integers in «x» along index «<code>I</code>»«<code>I</code>» can be omitted when taking the bitwise XOR across the [[Implicit dimension]].
 
  
 
Each integer may have up to 64 bits.
 
Each integer may have up to 64 bits.
  
 
== Examples ==
 
== Examples ==
 +
To find the bitwise XOR of three numbers, the numbers can be listed in brackets (the implicit index) and the index parameter omitted.
 +
:<code>BitXOr([23, 29, 25]) &rarr; 19</code>
  
To find the bitwise XOR of three numbers, the numbers can be listed in brackets (the implicit index) and the index parameter omitted.
 
:<code>[[BitXOr]]( [23, 29, 25] )</code> &rarr; 19
 
 
This is more obvious when we write these same numbers in [[Binary and hexadecimal integer formats|binary notation]]:
 
This is more obvious when we write these same numbers in [[Binary and hexadecimal integer formats|binary notation]]:
:<code>[[BitXOr]]( [0b10111, 0b11101, 0b11001] )</code> &rarr; 19  { note: 17 = 0b10011 }
+
:<code>BitXOr([0b10111, 0b11101, 0b11001]) &rarr; 19  { note: 19 = 0b10011 }</code>
  
Suppose x is the following 2-D array of integers
+
Suppose <code>x</code> is the following 2-D array of integers
 
:[[image:BitAnd_x.png]]
 
:[[image:BitAnd_x.png]]
 +
 
which is shown here in [[Binary and hexadecimal integer formats|binary notation]]
 
which is shown here in [[Binary and hexadecimal integer formats|binary notation]]
 
:[[image:binary_x_BitAnd.png]]
 
:[[image:binary_x_BitAnd.png]]
 +
 
then
 
then
:<code>[[BitXOr]](x,I)</code> &rarr; [[image:BitXOr_result1d.png]]  
+
:<code>BitXOr(x, I) &rarr;</code>
:::= [[image:BitXOr_result1.png]]
+
 
:<code>[[BitXOr]](x,J)</code> &rarr; [[image:BitXOr_result2.png]]
+
:[[image:BitXOr_result1d.png]]  
 +
:::=  
 +
:[[image:BitXOr_result1.png]]
 +
 
 +
:<code>BitXOr(x, J) &rarr;</code>  
 +
 
 +
:[[image:BitXOr_result2.png]]
 +
 
 +
==History==
 +
Introduced in [[Analytica 5.0]].
  
 
== See Also ==
 
== See Also ==
* [[BitAnd]], [[BitOr]], [[BitNot]]
+
* [[BitAnd]]
* [[BitCount]], [[BitShift]]
+
* [[BitOr]]
 +
* [[BitNot]]
 +
* [[BitCount]]
 +
* [[BitShift]]

Latest revision as of 01:27, 28 April 2016


BitXOr(x, I)

Returns the bitwise exclusive-OR (XOR) of the integer portions of an array of numbers. Each bit in the result is on only if the corresponding bit is on in an odd number of integers in «x» along index «I». «I» can be omitted when taking the bitwise XOR across the Implicit dimension.

Each integer may have up to 64 bits.

Examples

To find the bitwise XOR of three numbers, the numbers can be listed in brackets (the implicit index) and the index parameter omitted.

BitXOr([23, 29, 25]) → 19

This is more obvious when we write these same numbers in binary notation:

BitXOr([0b10111, 0b11101, 0b11001]) → 19 { note: 19 = 0b10011 }

Suppose x is the following 2-D array of integers

BitAnd x.png

which is shown here in binary notation

Binary x BitAnd.png

then

BitXOr(x, I) →
BitXOr result1d.png
=
BitXOr result1.png
BitXOr(x, J) →
BitXOr result2.png

History

Introduced in Analytica 5.0.

See Also

Comments


You are not allowed to post comments.