Networking, Programming and Graphics Tutorials

Boolean Operations Tables [1/1]

Type: Code Networking, Programming and Graphics Tutorials
Boolean Operations Tables
Level: Beginner Networking, Programming and Graphics Tutorials 
Boolean Operations Tables
Date: 2007-Jan-04
Boolean Operations Tables
Visited: 733 times
Boolean Operations Tables
Rating: Boolean Operations Tables
Boolean Operations Tables
Author: Alex Plumpton

A bit is the minimum amount of information that we can imagine, since it only stores either value 1 or 0, which represents either YES or NO, activated or deactivated, true or false, etc... that is: two possible states each one opposite to the other, without possibility of any shades. We are going to consider that the two possible values of a bit are 0 and 1.

Several operations can be performed with bits, either in conjunction with other bits or themselves alone. These operations receive the name of boolean operations, a word that come from the name of one of the mathematicians who more contributed to this field: George Boole (1815-1864).

All these operations have an established behavior and all of them can be applied to any bit no matter which value they contain (either 0 or 1). Next you have a list of the basic boolean operations and a table with the behaviour of that operation with every possible combination of bits.

AND
This operation is performed between two bits, which we will call a and b. The result of applying this AND operation is 1 if both a and b are equal to 1, and 0 in all other cases (i.e., if one or both of the variables is 0). AND (&)

OR
This operation is performed between two bits (a and b). The result is 1 if either one of the two bits is 1, or if both are 1. If none is equal to 1 the result is 0. OR (|)

XOR (Exclusive Or)
This operation is performed between two bits (a and b). The result is 1 if either one of the two bits is 1, but not in the case that both are. There for, if neither or both of them are equal to 1 the result is 0. XOR (^)

NOT
This operation is performed on a single bit. Its result is the inversion of the actual value of the bit: if it was set to 1 it becomes 0, and if it was 0 it becomes 1: NOT (~)

These are the 4 basic boolean operations (AND, OR, XOR and NOT). Combining these operations we can obtain any possible result from two bits.

Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Boolean Operations Tables [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: boolean tables c++  boolean operations in c++  $select tables php  Ajax & Php tables  ajax mysql tables  php-mysql update associated tables  link tables on select php  update tables mysql php  ajax php list tables  php script select from tables