Difference between revisions of "Manuals/calci/BITAND"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "<div style="font-size:30px">'''BITAND(n1)'''</div><br/> *where <math>n1</math> specifies the numeric value on which the bitwise NOT operation is performed. == Description =...")
 
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div style="font-size:30px">'''BITAND(n1)'''</div><br/>
+
<div style="font-size:30px">'''BITAND(n1,n2)'''</div><br/>
  
*where <math>n1</math> specifies the numeric value on which the bitwise NOT operation is performed.
+
*where <math>n1</math> and <math>n2</math> specify the numeric values on which the bitwise AND operation is performed.
  
  
 
== Description ==
 
== Description ==
  
*BITAND() returns the result of a bitwise NOT operation performed on a numeric value.
+
*BITAND() returns the result of bitwise AND operation performed on numeric values.
*<math>n1</math> specifies the numeric value.  If <math>n1</math> is not an integer, it is converted to an integer before its bits are shifted.
+
*<math>n1</math> and <math>n2</math> must be in decimal form and greater or equal to '0'.
*The numeric value returned by BITAND( ) represents <math>n1</math> with each bit of value 0 switched to 1 and each bit of value 1 switched to 0.
+
*The value of each bit position is counted only if both parameter's bits at that position are 1.
 +
*If either argument is a non-numeric value, BITAND returns the #VALUE! error value.
  
 
For Example,
 
For Example,
  
BITAND(1) = '''-2''' (Bit Not value of 'binary value 01' is '10' i.e -2.)
+
BITAND(1,6) = '''0''' (The binary representation of 1 is 1, and the binary representation of 6 is 110. Their bits do not match at any position. This is returned as 0.
 
 
BITAND(False) =  '''-1''' (Bit Not value of 'binary value 00' is '11' i.e -1.)
 
  
 +
BITAND(true, true) =  '''1''' (Bit AND value of 'true' is '1'. Bits match the position, hence result is 1.)
  
 
== Examples ==
 
== Examples ==
  
#=BITAND(TRUE) = -2
+
#=BITAND(3,5) = 1
#=BITAND(42) = -43
+
#=BITAND(17,-22) = 0
#=BITAND((2+7)>8) = -2
+
#=BITAND(-9,-3) = -11
#=BITAND(0.5) = -1
+
#=BITAND(0.5,0.1) = 0
#=BITAND("d")= -1
 
  
  
 
==Related Videos==
 
==Related Videos==
  
{{#ev:youtube|t8zhPx4kbkE|280|center|AND}}
+
{{#ev:youtube|kNRNw0VMelo|280|center|AND}}
  
  

Latest revision as of 05:36, 4 May 2017

BITAND(n1,n2)


  • where and specify the numeric values on which the bitwise AND operation is performed.


Description

  • BITAND() returns the result of bitwise AND operation performed on numeric values.
  • and must be in decimal form and greater or equal to '0'.
  • The value of each bit position is counted only if both parameter's bits at that position are 1.
  • If either argument is a non-numeric value, BITAND returns the #VALUE! error value.

For Example,

BITAND(1,6) = 0 (The binary representation of 1 is 1, and the binary representation of 6 is 110. Their bits do not match at any position. This is returned as 0.

BITAND(true, true) = 1 (Bit AND value of 'true' is '1'. Bits match the position, hence result is 1.)

Examples

  1. =BITAND(3,5) = 1
  2. =BITAND(17,-22) = 0
  3. =BITAND(-9,-3) = -11
  4. =BITAND(0.5,0.1) = 0


Related Videos

AND


See Also


References