Difference between revisions of "BitAnd"

(Created page with "category:Bit functions ''new in Analytica 4.7'' == BitAnd( x'', I'' ) == Returns the bitwise AND of the integer portions of an array of numbers. Each bit in the res...")
 
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]]''
+
== BitAnd(x'', I'') ==
 
+
Returns the bitwise AND of the integer portions of an array of numbers. Each bit in the result is on only if it is on in every integer in «x» along index «I»«I» can be omitted when taking the bitwise AND across the [[Implicit dimension]].
== BitAnd( x'', I'' ) ==
 
 
 
Returns the bitwise AND of the integer portions of an array of numbers. Each bit in the result is on only if it is on in every integer in «x» along index «<code>I</code>»«<code>I</code>» can be omitted when taking the bitwise AND 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 And of three numbers, the numbers can be listed in brackets (the implicit index) and the index parameter omitted.
 +
:<code>BitAnd([23, 29, 25]) &rarr; 17</code>
  
To find the bitwise And of three numbers, the numbers can be listed in brackets (the implicit index) and the index parameter omitted.
 
:<code>[[BitAnd]]( [23, 29, 25] )</code> &rarr; 17
 
 
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>[[BitAnd]]( [0b10111, 0b11101, 0b11001] )</code> &rarr; 17  { note: 17 = 0b10001 }
+
:<code>BitAnd([0b10111, 0b11101, 0b11001]) &rarr; 17  { note: 17 = 0b10001 }</code>
 +
 
 +
Suppose <code>x</code> is the following 2-D array of integers
  
Suppose x 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>[[BitAnd]](x,I)</code> &rarr; [[image:BitAnd_result1d.png]]  
+
:<code>BitAnd(x, I) &rarr;</code>  
:::= [[image:BitAnd_result1.png]]
+
 
:<code>[[BitAnd]](x,J)</code> &rarr; [[image:BitAnd_result2.png]]
+
:[[image:BitAnd_result1d.png]]  
 +
::=
 +
:[[image:BitAnd_result1.png]]
 +
 
 +
:<code>[[BitAnd]](x, J) &rarr; </code>  
 +
 
 +
:[[image:BitAnd_result2.png]]
 +
 
 +
==History==
 +
Introduced in [[Analytica 5.0]].
  
 
== See Also ==
 
== See Also ==
* [[BitOr]], [[BitNot]], [[BitXOr]]
+
* [[BitOr]]
* [[BitCount]], [[BitShift]]
+
* [[BitNot]]
* Logical [[AND]]
+
* [[BitXOr]]
 +
* [[BitCount]]
 +
* [[BitShift]]
 +
* Logical [[And]]

Latest revision as of 01:26, 28 April 2016


BitAnd(x, I)

Returns the bitwise AND of the integer portions of an array of numbers. Each bit in the result is on only if it is on in every integer in «x» along index «I». «I» can be omitted when taking the bitwise AND across the Implicit dimension.

Each integer may have up to 64 bits.

Examples

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

BitAnd([23, 29, 25]) → 17

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

BitAnd([0b10111, 0b11101, 0b11001]) → 17 { note: 17 = 0b10001 }

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

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

History

Introduced in Analytica 5.0.

See Also

Comments


You are not allowed to post comments.