Difference between revisions of "Template:LogicalTruthTable"

From QB64 Wiki
Jump to navigation Jump to search
imported>Stylin
(new template for embedding in logical operator pages)
 
imported>Clippy
m
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The following table shows the results of the bitwise logical operations, where ''<tt>A</tt>'' and ''<tt>B</tt>'' are operands, and ''T'' and ''F'' indicate a bit in the operand that is set or not set, respectively:
<center>The results of the bitwise logical operations, where ''A'' and ''B'' are operands, and ''T'' and ''F'' indicate that a bit is set or not set:</center>


:{| border="1" cellpadding="2"
:{| border="1" cellpadding="2" align="center"
|-
|-
!colspan="2"|Operands || colspan="6"|Operations
!colspan="2"|Operands || colspan="6"|Operations
|-
|-
|align="center"|<tt>A</tt> || align="center"|<tt>B</tt> || align="center"|<tt>[[NOT]] B</tt> || align="center"|<tt>A [[AND]] B</tt> || align="center"|<tt>A [[OR]] B</tt>|| align="center"|<tt>A [[XOR]] B</tt>|| align="center"|<tt>A [[EQV]] B</tt>|| align="center"|<tt>A [[IMP]] B</tt>
|align="center"|A || align="center"|B || align="center"|<tt>[[NOT]] B</tt> || align="center"|<tt>A [[AND]] B</tt> || align="center"|<tt>A [[OR]] B</tt>|| align="center"|<tt>A [[XOR]] B</tt>|| align="center"|<tt>A [[EQV]] B</tt>|| align="center"|<tt>A [[IMP]] B</tt>
|-
|-
|align="center"|T || align="center"|T || align="center"|F || align="center"|T || align="center"|T || align="center"|F || align="center"|T || align="center"|T
|align="center"|T || align="center"|T || align="center"|F || align="center"|T || align="center"|T || align="center"|F || align="center"|T || align="center"|T
Line 15: Line 15:
|align="center"|F || align="center"|F || align="center"|T || align="center"|F || align="center"|F || align="center"|F || align="center"|T || align="center"|T
|align="center"|F || align="center"|F || align="center"|T || align="center"|F || align="center"|F || align="center"|F || align="center"|T || align="center"|T
|}
|}
:'''Note that the [[Relational Operations]] return negative one (<tt>-1</tt>, all bits set) and zero (<tt>0</tt>, no bits set) for ''true'' and ''false'', respectively. This allows relational tests to be inverted and combined with the bitwise logical operations.'''
<center>'''[[Relational Operations]] return negative one (-1, all bits set) and zero (0, no bits set) for ''true'' and ''false'', respectively.</center>
<center> This allows relational tests to be inverted and combined using the bitwise logical operations.'''</center>


<noinclude>
<noinclude>

Latest revision as of 15:19, 10 August 2013

The results of the bitwise logical operations, where A and B are operands, and T and F indicate that a bit is set or not set:
Operands Operations
A B NOT B A AND B A OR B A XOR B A EQV B A IMP B
T T F T T F T T
T F T F T T F F
F T F F T T F T
F F T F F F T T
Relational Operations return negative one (-1, all bits set) and zero (0, no bits set) for true and false, respectively.
This allows relational tests to be inverted and combined using the bitwise logical operations.