Please Whitelist This Site?

I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)

If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.

If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.

Thanks for your understanding!

Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide


NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

Read offline with no ads or diagram watermarks!
The TCP/IP Guide

Custom Search







Table Of Contents  The TCP/IP Guide
 9  Networking Fundamentals
      9  Backgrounder: Data Representation and the Mathematics of Computing

Previous Topic/Section
Binary, Octal and Hexadecimal Arithmetic
Previous Page
Pages in Current Topic/Section
1
23
Next Page
Bit Masking (Setting, Clearing and Inverting) Using Boolean Logical Functions
Next Topic/Section

Boolean Logic and Logical Functions
(Page 1 of 3)

Every bit in a computer system can hold a value of either “one” or “zero”, which represent the basic “on” or “off” states inherent in a binary digital system. In the preceding topics in this section, I demonstrated how groups of these bits can be collected into sets to represent larger binary numbers, and then how those can be used for performing various mathematical operations.

However, as I mentioned when I introduced the concept of binary information, we can also interpret the “on” and “off' values of a binary digit as “true” or “false” respectively. These can represent various logical conditions within a computer or other system. Furthermore, there are various logical operations that can be used to manipulate and combine these “true” or “false” values to represent more complex logical states. One of the pioneers of using binary values in logical thought was British mathematician George Boole (1815-1864), and in recognition of his contribution to this field, this system of binary values and conditions is commonly called boolean logic.

Boolean Logical Functions

Boolean logic defines a number of boolean logical functions, which are also sometimes called operators. Each of these uses a logical algorithm to compute an output value based on the value of one or more inputs. The algorithm determines when the output is a “true” value, based on what combination of “true” and “false” values the inputs take. For this reason, the table that shows the inputs and outputs for a logical function is called a truth table. Each of the logical functions is analogous to a “real world” logical operation that we use to define various logical situations, as we will see.

It is much easier to see how boolean logic works by looking at examples, rather than reading these types of formal descriptions. So, let's just jump right in and see it in action, by looking at the different functions and how they work.

The NOT Function

Let's start with the simplest, the NOT function. As you might expect, this is a just a negation; the output is the opposite of the input. The NOT function takes only one input, so it is called a unary function or operator. The truth table for NOT is shown in Table 9. As you can see, the output is true when the input is false, and vice-versa.


Table 9: NOT Operator Truth Table

Input

Output

False

True

True

False


The NOT function logically represents the opposite of a condition. For example, suppose we have a bit called “B1” whose logical meaning is that when the bit is “true”, a particular pixel on a screen is lit up. Then the boolean expression “NOT B1” would be the opposite: it would be false when the pixel is lit up, and thus true only when the pixel is not lit up. Pretty straight-forward.

Now, before proceeding further, I am going to play a little trick on you. J As I said above, boolean logic is based on “true” and “false” values. However, I also said that “true” and “false” are represented in computers by “one” or “zero” values. For this reason, boolean logic is often expressed in terms of ones and zeroes, instead of “true” and “false”. The circuits inside computer processors and other devices manipulate one and zero bits directly using these functions. In some (but not all) cases they interpret “one” and “zero” as “true” and “false”, but in either case the two representations are functionally equivalent.

Table 10 shows the same truth table as Table 9, but using bit values: each "True" is represented as a 1 and each "False" as a 0.


Table 10: NOT Operator Truth Table (Using Bit Values)

Input

Output

0

1

1

0


Previous Topic/Section
Binary, Octal and Hexadecimal Arithmetic
Previous Page
Pages in Current Topic/Section
1
23
Next Page
Bit Masking (Setting, Clearing and Inverting) Using Boolean Logical Functions
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005

© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.