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!

Enjoy The TCP/IP Guide? Get the complete PDF!
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
2
3
Next Page
Bit Masking (Setting, Clearing and Inverting) Using Boolean Logical Functions
Next Topic/Section

Boolean Logic and Logical Functions
(Page 2 of 3)

The AND and OR Functions

There are two other primary boolean functions that are widely used: the AND function and the OR function. The output of an AND function is true only if its first input and its second input and its third input (etc.) are all true. The output of an OR function is true if the first input is true or the second input is true or the third input is true (again, etc.)

Both AND and OR can have any number of inputs, with a minimum of two. Table 11 shows the truth table for the AND function, with two inputs. You can see that the output is a 1 only when both inputs are 1, and is 0 otherwise.


Table 11: AND Operator Truth Table

Input #1

Input #2

Output

0

0

0

0

1

0

1

0

0

1

1

1


Like the NOT function, the AND function represents a logical operation similar to how we use the word in our every day lives. For example, at lunch time, I might suggest to a colleague "let's go out for lunch and stop at the post office".

The truth table for the OR function (again with two inputs) is shown in Table 12. Here, the output is 1 whenever a 1 appears in at least one input, not necessarily both as in the previous table.


Table 12: OR Operator Truth Table

Input #1

Input #2

Output

0

0

0

0

1

1

1

0

1

1

1

1


Interestingly, unlike the AND function, the boolean OR function in fact does not have the same meaning as the way that we routinely use the word “or” in English. When we say “or”, we usually mean one “or” the other, but not both: “you can have apple pie or chocolate cake for dessert”. In the boolean OR however, the output is true as long as any of the inputs is true, even if more than one is.

Exclusive-OR (XOR or EOR)

A modification of OR called Exclusive-OR (abbreviated either XOR or EOR) represents the way we normally use “or” in the real world. Its output is only true if one input is true or the other, but not both. The truth table for XOR is as shown in Table 13. Notice the difference between this table and Table 12: the output is 0 in the case where both inputs is 1.


Table 13: Exclusive OR (XOR) Operator Truth Table

Input #1

Input #2

Output

0

0

0

0

1

1

1

0

1

1

1

0


Previous Topic/Section
Binary, Octal and Hexadecimal Arithmetic
Previous Page
Pages in Current Topic/Section
1
2
3
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.