Documente Academic
Documente Profesional
Documente Cultură
Decimal notation is the writing of numbers in the base 10 numeral system, which uses various symbols
(called digits) for no more than ten distinct values (0, 1, 2, 3, 4, 5, 6, 7, 8 and 9) to represent any numbers,
no matter how large or how small. These digits are often used with a decimal separator which indicates the
start of a fractional part, and with one of the sign symbols + (positive) or − (negative) in front of the
numerals to indicate sign. There are only two truly positional decimal systems in ancient civilization, the
Chinese counting rods system and Hindu-Arabic numeric system both required no more than ten symbols.
Other numeric systems require more or fewer symbols.
The decimal system is a positional numeral system; it has positions for units, tens, hundreds, etc. The
position of each digit conveys the multiplier (a power of ten) to be used with that digit—each position has a
value ten times that of the position to its right.
Ten is the number which is the count of fingers and thumbs on both hands (or toes on the feet). In many
languages the word digit or its translation is also the anatomical term referring to fingers and toes. In
English, decimal means tenth, decimate means reduce by a tenth and denary means the unit of ten. The
symbols for the digits in common use around the globe today are called Arabic numerals by Europeans and
Indian numerals by Arabs, the two groups' terms both referring to the culture from which they learned the
system. However, the symbols used in different areas are not identical; for instance, Western Arabic
numerals (from which the European numerals are derived) differ from the forms used by other Arab
cultures.
A binary number can be represented by any sequence of bits (binary digits), which in turn may be
represented by any mechanism capable of being in two mutually exclusive states.
In keeping with customary representation of numerals using Arabic numerals, binary numbers are
commonly written using the symbols 0 and 1. When written, binary numerals are often subscripted, prefixed
or suffixed in order to indicate their base, or radix. The following notations are equivalent:
When spoken, binary numerals are usually read digit-by-digit, in order to distinguish them from decimal
numbers. For example, the binary numeral 100 is pronounced one zero zero, rather than one hundred, to
make its binary nature explicit, and for purposes of correctness. Since the binary numeral 100 is equal to the
decimal value four, it would be confusing, and numerically incorrect, to refer to the numeral as one hundred.
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.1 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
7410 = 10010102
For example, the binary representation for decimal 74 is 1001010, which groups into 001 001 010 — so the
octal representation is 112.
By performing the calculation above in the familiar decimal system we see why 112 in octal is equal to
64+8+2 = 74 in decimal.
Its primary use is as a human friendly representation of binary coded values, so it is often used in digital
electronics and computer engineering. Since each hexadecimal digit represents four binary digits (bits)—
also called a nibble—it is a compact and easily translated shorthand to express values in base two.
7410=4Ahex
To convert a decimal number to binary, first subtract the largest possible power of two, and keep subtracting
the next largest possible power from the remainder, marking 1s in each column where this is possible and 0s
where it is not.
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.2 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
BINARY ADDITION
Binary addition is performed in a similar way to decimal addition. We apply these rules
1) 0+0=0
2) 1+0=1
3) 0+1=1
4) 1+1=10 (with a carry of 1)
When 1+1 is performed, 1+1=0 and carry 1.
BINARY SUBTRACTION
Binary subtraction is performed in a similar way to decimal subtraction. We apply these rules
1) 1-1=0
2) 1-0=1
3) 0-1=1 (with a borrow of 1)
4) 0-0=0
Example 1: Subtract (0101)2 and (1001)2
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.3 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
Binary Decimal
1001 9
-0101 - 5
0100 4
Apart from arithmetic operators, we can define logical operators which operate on what are called truth
values; a truth value can be TRUE or FALSE.
We can define the results of Boolean operations using a truth table. A truth table lists all possible
combinations of the operands, and, for each combination, gives the value of the expression. For example,
consider the expression;
A AND B
There are two operands, A and B. Since each operand can have up to two values, there are four
combinations of A and B, thus:
A B
False False
False True
True False
True True
The truth table for A and B is:
A B A AND B
False False False
False True False
True False False
True True True
Note that A AND B is True only when both A and B are True; it is False when at least one of A, B is false.
Similarly, we can define the Boolean operator OR as follows:
A B A OR B
False False False
False True True
True False True
True True True
Note that A OR B is True when one (or both) of A, B is True; it is False only when both A and B are False.
The other common operator is NOT. This is different in that it takes only one operand; it is defined by:
In other words, A NOT A NOT simply reverses the truth value of its operand.
False True
COMPOUND True False EXPRESSION
The expressions:
A AND B
A OR B
NOT A
are called simple expressions, since each contains only the operator. We can also have compound
expressions, consisting more than one operator. For example,
NOT (A AND B)
We can derive the truth table for this expression in stages. We first do A and B, then we apply NOT (with F
representing False and T representing True):
But consider:
A AND (NOT B)
Here we first apply NOT to B, then we apply AND to A and the result of (NOI B). This is illustrated as
follows:
Note that we need to know the value of A AND (NOT B) for all possible combinations of its operands.
There are two operands involved, so our table begins by listing the four possible combination of A and B.
Ex: Derive the truth table for the following Boolean expressions
1. NOT ( A OR B)
2. (NOT A) OR (NOT B)
3. (NOT A ) OR B
4. (NOT A ) AND (NOT B)
5. (NOT A) AND (A OR (NOT B))
In the previous examples, a Boolean expression was given from which the truth table was derived.
Sometimes, however, a truth table can be constructed from a description. Consider the following:
Derive a truth table with inputs A, B and C. The output W is True when at least two of the inputs are True
and False otherwise.
In this case, we have no Boolean expression to use. However, after we have listed all possible combinations
of A, B and C, we need only to count how many True values (N, say) we have on one line; if N is 2 or 3,
then W is True; if N is 0 or 1, w is False.
A B C W
F F F F
F F T F
F T F F
F T T T
T F F F
T F T T
T T F T
T T T T
Ex: Derive truth tables for the following: inputs are A, B and C.
a) W is true if an even number of inputs is True, and False otherwise.
b) W is true if exactly one input is True, and False otherwise.
c) W is True if A and C are same, and False otherwise.
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.6 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
LOGIC GATES
We have already seen that every thing a computer can do must be converted into 0s and 1s.All information
is represented inside the computer using strings of 0s and 1s. In particular, all arithmetic is done using the
binary number system.
In order for a computer to do arithmetic as well as make logical comparisons, logic circuits are required. A
logic circuit is made of individual unit called gates. These gates can be compared with the Boolean
operators described in the previous section.
The most common gates are AND, OR and NOT. On circuit diagrams, the following symbols can be used to
represent these gates; either of the two symbols shown below may be used.
Operator Symbol
AND
OR
NOT
A gate has one or more inputs and one or more outputs. We will use the following:
AND -two inputs and one output;
OR -two inputs and one output;
NOT –one input and one output.
The gates operate exactly the same as the Boolean operators. However, it is usual to speak of the inputs and
outputs of the gates being 0 or 1, rather than True or False.
This gate consists of two inputs (A and B, say) and one output (out, say).
The following truth table describes the action of the AND gates:
A B out
0 0 0
0 1 0
1 0 0
1 1 1
Note that the table is exactly the same as for the Boolean Operator AND, with False replaced by 0 and True
replaced by 1.
The OR gate
This has the same inputs and outputs as the AND gate.
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.7 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
The following truth table describes the action of the NOT gates:
A out
0 1
1 0
The NOT gate is usually referred to as an inverter, since it ‘inverts’ its input (0 to 1, or 1 to 0).
LOGIC CORCUITS
A logic circuit consists of a number of gates joined together to produce a specified output (or outputs) form
the given inputs.
It contains three inputs A, B and C. We can think of these as three wires which may or may not conduct a
current. If a wire is conducting a current, we say the value of the input is 1; of not, the value is 0.
There are two intermediate outputs, W and X, the (final) output of the circuit is represented by Y. From the
diagram we can see that:
W=A AND B
X=NOT C
Y=W OR X
We can therefore construct the truth table which species the behavior of the circuits; that is, what output is
produced for a given combination of inputs. For example, what is Y when:
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.8 Er. Subash Dangol
Modern Nepal College, Bagbazar, Kathmandu.
AND NOT OR
A B C W X Y
0 0 0 0 1 1
0 0 1 0 0 0
0 1 0 0 1 1
0 1 1 0 0 0
1 0 0 0 1 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 1 0 1
From the truth table, we see that when A=0, B=0 and C=1, the value of Y is 0.
Unit 2/ Number System, Boolean Operation and Logic Circuits/Page No.9 Er. Subash Dangol