Difference between revisions of "BITAND()"

From Lianjapedia
Jump to: navigation, search
m (1 revision)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
==Purpose==
 
==Purpose==
 
Function to perform bitwise AND operation
 
Function to perform bitwise AND operation
 
  
 
==Syntax==
 
==Syntax==
 
BITAND(<expN1>,<expN2>[,…<expN26>])
 
BITAND(<expN1>,<expN2>[,…<expN26>])
 
  
 
==See Also==
 
==See Also==
 
[[BITCLEAR()]], [[BITLSHIFT()]], [[BITNOT()]], [[BITOR()]], [[BITRSHIFT()]], [[BITSET()]], [[BITTEST()]], [[BITXOR()]]
 
[[BITCLEAR()]], [[BITLSHIFT()]], [[BITNOT()]], [[BITOR()]], [[BITRSHIFT()]], [[BITSET()]], [[BITTEST()]], [[BITXOR()]]
 
  
 
==Description==
 
==Description==
Line 16: Line 13:
 
BITAND() compares each bit in turn of <expN1> and <expN2>.  If both bits are 1, the corresponding bit in the result is set to 1, otherwise the result bit is 0.  If <expN3> is specified, the initial result is compared bit by bit with <expN3> and a new result evaluated.  This new result is then compared with <expN4>, if specified, and so on.
 
BITAND() compares each bit in turn of <expN1> and <expN2>.  If both bits are 1, the corresponding bit in the result is set to 1, otherwise the result bit is 0.  If <expN3> is specified, the initial result is compared bit by bit with <expN3> and a new result evaluated.  This new result is then compared with <expN4>, if specified, and so on.
  
 
+
{| class="wikitable" width="100%"
{| class="wikitable"
+
 
!<expN1> bit||<expN2> bit||Result bit
 
!<expN1> bit||<expN2> bit||Result bit
 
|-
 
|-
Line 29: Line 25:
 
|-
 
|-
 
|}
 
|}
 
  
 
==Example==
 
==Example==
Line 42: Line 37:
 
</code>
 
</code>
  
 
==Products==
 
Recital Server, Recital
 
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Functions]]
 
[[Category:Functions]]
[[Category:Bitwise Operations]]
+
[[Category:Numeric Data Functions]]
[[Category:Bitwise Operations Functions]]
+

Latest revision as of 08:43, 4 February 2013

Purpose

Function to perform bitwise AND operation

Syntax

BITAND(<expN1>,<expN2>[,…<expN26>])

See Also

BITCLEAR(), BITLSHIFT(), BITNOT(), BITOR(), BITRSHIFT(), BITSET(), BITTEST(), BITXOR()

Description

The BITAND() function performs a bitwise AND operation on the specified numeric parameters. Up to 26 parameters can be specified. These parameters, if not integers, will be converted to integer values before the operation takes place.

BITAND() compares each bit in turn of <expN1> and <expN2>. If both bits are 1, the corresponding bit in the result is set to 1, otherwise the result bit is 0. If <expN3> is specified, the initial result is compared bit by bit with <expN3> and a new result evaluated. This new result is then compared with <expN4>, if specified, and so on.

<expN1> bit <expN2> bit Result bit
0 0 0
0 1 0
1 1 1
1 0 0

Example

x = 3   && 0011
y = 6   && 0110
z = 7	&& 0111
? bitand(x,y)
         2     && 0010
? bitand(x,y,z)
         2     && 0010