History of The Numeral Systems:: Unit1: Number Systems & Codes
History of The Numeral Systems:: Unit1: Number Systems & Codes
History of The Numeral Systems:: Unit1: Number Systems & Codes
caused by leading zeros. Bijective base-k numeration is also called k-adic notation, not to be confused with padic numbers. Bijective base-1 the same as unary.
Five
A base-5 system (quinary), on the number of fingers, has been used in many cultures for counting. It may also
be regarded as a sub-base of other bases, such as base 10 and base 60.
Eight
A base-8 system (octal), spaces between the fingers , was devised by the Yuki of Northern California, who used
the spaces between the fingers to count, corresponding to the digits one through eight
Ten
The base-10 system (decimal) is the one most commonly used today. It is assumed to have originated because
humans have ten fingers. These systems often use a larger superimposed base.
Twelve
Base-12 systems (duodecimal or dozenal) have been popular. It is the smallest multiple of one, two, three,
four and six. There is still a special word for 121, dozen and a word for 122, gross. Multiples of 12 have been in
common use as English units of resolution in the analog and digital printing world, where 1 point equals 1/72
of an inch and 12 points equal 1 pica, and printer resolutions like 360, 600, 720, 1200 or 1440 dpi (dots per
inch) are common. These are combinations of base-12 and base-10 factors: (312)10, (512)10, (612)10,
(1012)10 and (1212)10.
Twenty
The Maya civilization and other civilizations of Pre-Columbian Mesoamerica used base-20 (vigesimal).
Remnants of a Gaulish base-20 system also exist in French, as seen today in the names of the numbers from
60 through 99. The Irish language also used base-20 in the past. Danish numerals display a similar base20 structure.
Sixty
Base 60 (sexagesimal) was used by the Sumerians and their successors in Mesopotamia and survives today in
our system of time (hence the division of an hour into 60 minutes and a minute into 60 seconds) and in our
system of angular measure (a degree is divided into 60 minutes and a minute is divided into 60 seconds). 60
also has a large number of factors, including the first six counting numbers. Base-60 systems are believed to
have originated through the merging of base-10 and base-12 systems.
Dual base (five and twenty)
Many ancient counting systems use 5 as a primary base, almost surely coming from the number of fingers on a
person's hand. Often these systems are supplemented with a secondary base, sometimes ten, sometimes
twenty. In some African languages the word for 5 is the same as "hand" or "fist". Counting continues by adding
1, 2, 3, or 4 to combinations of 5, until the secondary base is reached. In the case of twenty, this word often
means "man complete". This system is referred to as quinquavigesimal. It is found in many languages of the
Sudan region.
BINARY
The ancient Indian writer Pingala developed advanced mathematical concepts for describing prosody, and in
doing so presented the first known description of a binary numeral system.
A full set of 8 trigrams and 64 hexagrams, analogous to the 3-bit and 6-bit binary numerals, were known to
the ancient Chinese in the classic text I Ching. An arrangement of the hexagrams of the I Ching, ordered
according to the values of the corresponding binary numbers (from 0 to 63), and a method for generating the
same, was developed by the Chinese scholar and philosopher Shao Yong in the 11th century.
In 1854, British mathematician George Boole published a landmark paper detailing an algebraic system of
logic that would become known as Boolean algebra. His logical calculus was to become instrumental in the
design of digital electronic circuitry.
In 1937, Claude Shannon produced his master's thesis at MIT that implemented Boolean algebra and
binary arithmetic using electronic relays and switches for the first time in history. Entitled A Symbolic
Analysis of Relay and Switching Circuits, Shannon's thesis essentially founded practical digital circuit
design.
In November 1937, George Stibitz, then working at Bell Labs, completed a relay-based computer he dubbed
the "Model K" (for "Kitchen", where he had assembled it), which calculated using binary addition. The
Complex Number Computer was completed by January 8, 1940, was able to calculate complex numbers.
On September 11, 1940, Stibitz was able to send the Complex Number Calculator remote commands over
telephone lines by a teletype.
Binary codes
Binary codes are codes which are represented in binary system with modification from the original ones.
Weighted Binary codes
Non Weighted Codes
Weighted binary codes are those which obey the positional weighting principles, each position of the number
represents a specific weight. The binary counting sequence is an example.
Decimal
BCD
Bi-Quinary
Excess-3 84-2-1 2421 5211
8421
5043210
0
1
2
0000
0001
0010
0011
0100
0101
0
1
2
X
X
X
3
4
0011
0100
0110
0111
3
4
X
X
5
6
0101
0110
1000
1001
5
6
X
X
7
8
0111
1000
1010
1011
7
8
X
X
1001
1111
0
X
X
X
X
X
X
X
X
X
X
Reflective Code
A code is said to be reflective when code for 9 is complement for the code for 0, and so is for 8 and 1
codes, 7 and 2, 6 and 3, 5 and 4. Codes 2421, 5211, and excess-3 are reflective, whereas the 8421
code is not.
Sequential Codes
A code is said to be sequential when two subsequent codes, seen as numbers in binary
representation, differ by one. This greatly aids mathematical manipulation of data. The 8421 and
Excess-3 codes are sequential, whereas the 2421 and 5211 codes are not.
Non weighted codes
Non weighted codes are codes that are not positionally weighted. That is, each position within the
binary number is not assigned a fixed value. Ex: Excess-3 code
Excess-3 Code
Excess-3 is a non weighted code used to express decimal numbers. The code derives its name from
the fact that each binary code is the corresponding 8421 code plus 0011(3).
Gray Code
The gray code belongs to a class of codes called minimum change codes, in which only one bit in the code
changes when moving from one code to the next. The Gray code is non-weighted code, as the position of bit
does not contain any weight. The gray code is a reflective digital code which has the special property that any
two subsequent numbers codes differ by only one bit. This is also called a unit-distance code. In digital Gray
code has got a special place.
Decimal
Number
Binary
Code
Gray Code
Decimal
Number
Binary
Code
Gray Code
0
1
0000
0001
0000
0001
8
9
1000
1001
1100
1101
2
3
0010
0011
0011
0010
10
11
1010
1011
1111
1110
4
5
0100
0101
0110
0111
12
13
1100
1101
1010
1011
6
7
0110
0111
0101
0100
14
15
1110
1111
1001
1000
Error-Detection Codes
Binary information may be transmitted through some communication medium, e.g. using wires or
wireless media. A corrupted bit will have its value changed from 0 to 1 or vice versa. To be able to
detect errors at the receiver end, the sender sends an extra bit (parity bit) with the original binary
message.
A parity bit is an extra bit included with the n-bit binary message to make the total number of 1s in this
message (including the parity bit) either odd or even. If the parity bit makes the total number of 1s an odd
(even) number, it is called odd (even) parity. The table shows the required odd (even) parity for a 3-bit
message. At the receiver end, an error is detected if the message does not match have the proper parity
(odd/even). Parity bits can detect the occurrence 1, 3, 5 or any odd number of errors in the transmitted
message. At the receiver end, an error is detected if the message does not match have the proper parity
(odd/even). Parity bits can detect the occurrence 1, 3, 5 or any odd number of errors in the transmitted
message. No error is detectable if the transmitted message has 2 bits in error since the total number of 1s will
remain even (or odd) as in the original message. In general, a transmitted message with even number of errors
cannot be detected by the parity bit.
Three-Bit Message
X
0
0
0
0
1
1
1
1
Y
0
0
1
1
0
0
1
1
Z
0
1
0
1
0
1
0
1
Odd
Parity
Bit
P
1
0
0
1
0
1
1
0
Even
Parity
Bit
P
0
1
1
0
1
0
0
1
Binary information may be transmitted through some communication medium, e.g. using wires or
wireless media. Noise in the transmission medium may cause the transmitted binary message to be
corrupted by changing a bit from 0 to 1 or vice versa. To be able to detect errors at the receiver end,
the sender sends an extra bit (parity bit).
Gray Code
The Gray code consists of 16 4-bit code words to represent the decimal Numbers 0 to 15. For Gray
code, successive code words differ by only one bit from one to the next as shown in the table and
further illustrated in the Figure.
Repetition codes are not very efficient, and can be susceptible to problems if the error occurs in exactly the
same place for each group (e.g., "1010 1010 1010" in the previous example would be detected as correct). The
advantage of repetition codes is that they are extremely simple, and are in fact used in some transmissions
of numbers stations.
Parity bits
A parity bit is a bit that is added to a group of source bits to ensure that the number of set bits (i.e., bits with
value 1) in the outcome is even or odd. It is a very simple scheme that can be used to detect single or any
other odd number (i.e., three, five, etc.) of errors in the output. An even number of flipped bits will make the
parity bit appear correct even though the data is erroneous.
Extensions and variations on the parity bit mechanism are horizontal redundancy checks, vertical redundancy
checks, and "double," "dual," or "diagonal" parity (used in RAID-DP).
Checksums
A checksum of a message is a modular arithmetic sum of message code words of a fixed word length (e.g.,
byte values). The sum may be negated by means of a one's-complement prior to transmission to detect errors
resulting in all-zero messages.
Checksum schemes include parity bits, check digits, and longitudinal redundancy checks. Some checksum
schemes, such as the Luhn algorithm and the Verhoeff algorithm, are specifically designed to detect errors
commonly introduced by humans in writing down or remembering identification numbers.
Error-correcting codes
Any error-correcting code can be used for error detection. A code with minimum Hamming distance, d, can
detect up to d-1 errors in a code word. Using minimum-distance-based error-correcting codes for error
detection can be suitable if a strict limit on the minimum number of errors to be detected is desired.
Codes with minimum Hamming distance d=2 are degenerate cases of error-correcting codes, and can be used
to detect single errors. The parity bit is an example of a single-error-detecting code.
The Berger code is an early example of a unidirectional error(-correcting) code that can detect any number of
errors on an asymmetric channel, provided that only transitions of cleared bits to set bits or set bits to cleared
bits can occur.
Hamming Codes
It is an error correction code that separates the bits holding the original value (data bits) from the error
correction bits (check bits), and the difference between the calculated and actual error correction bits is the
position of the bit that's wrong.
Error correction codes are a way to represent a set of symbols so that if any 1 bit of the representation is
accidentally flipped, you can still tell which symbol it was. For example, you can represent two symbols x and y
in 3 bits with the values x=111 and y=000. If you flip any one of the bits of these values, you can still tell which
symbol was intended. If more than 1 bit changes, you can't tell, and you probably get the wrong answer. So it
goes; 1-bit error correction codes can only correct 1-bit changes. If b bits are used to represent the symbols,
then each symbol will own 1+b values: the value representing the symbol, and the values differing from it by 1
bit. In the 3-bit example above, y owned 1+3 values: 000, 001, 010, and 100. Representing n symbols in b bits
will consume n*(1+b) values. If there is a 1-bit error correction code of b bits for n symbols, then n*(1+b) <=
2b. An x-bit error correction code requires that n*( (b choose 0) + (b choose 1) + ... + (b choose x) ) <= 2b.
The key to the Hamming Code is the use of extra parity bits to allow the identification of a single error. Create
the code word as follows:
1. Mark all bit positions that are powers of two as parity bits. (positions 1, 2, 4, 8, 16, 32, 64, etc.)
2. All other bit positions are for the data to be encoded. (positions 3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 17,
etc.)
3. Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit
determines the sequence of bits that it alternately checks and skips.
Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...)
Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...)
Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...)
Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc. (8-15,24-31,40-47,...)
Position 16: check 16 bits, skip 16 bits, check 16 bits, skip 16 bits, etc. (16-31,48-63,80-95,...)
Position 32: check 32 bits, skip 32 bits, check 32 bits, skip 32 bits, etc. (32-63,96-127,160-191,...)
etc.
4. Set a parity bit to 1 if the total number of ones in the positions it checks is odd. Set a parity bit to 0 if
the total number of ones in the positions it checks is even.
Here is an example:
A byte of data: 10011010
Create the data word, leaving spaces for the parity bits: _ _ 1 _ 0 0 1 _ 1 0 1 0
Calculate the parity for each parity bit (a ? represents the bit position being set):
1
1
1
1
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
C1
C2
C3
C4
0
0
0
0
Therefore No
Error
111110001100
1 1 1
1 1 1
1 1 1
1 1 1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
0
C1
C2
C3
C4
0
1
0
0
Error is in Bit 4
000010001010
0 0 0 0
C1 1
Error is in Bit
0
0
0
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
0
0
0
0
0
0
1
1
1
0
0
0
1
1
1
0
0
0
C2 1
C3 1
C4 0
Binary Arithmetic:
An ordinary decimal number can be regarded as a polynomial in powers of 10. For example, 423.12
can be regarded as 4 X102 + 2 X101 + 3 X100 + 1 X10-1 + 2 X10-2. Decimal numbers like this are said
to be expressed in a number system with base, or radix, 10 because there are 10 basic digits (0, 1, 2,
, 9) from which the number system is formulated. In a similar fashion we can express any number N
in a system using any base b. We shall write such a number as (N)b . Whenever (N)b is written, the
convention of always expressing b in base 10 will be followed. Thus (N)b = (pn pn-1 p1p0 . p-1p-2 p-m
)b where b is an integer greater than 1 and 0 < pi < b -1. The value of a number represented in this
fashion, which is called positional notation, is given by
(N)b = pn bn + pn-1 bn-1 + + p0 b0 +p-1b-1 +p-2b-2+..+p-mb-m
(N ) =
b
n
t = m
pb
i
For decimal numbers, the symbol . is called the decimal point; for more general base-b numbers, it
is called the radix point. That portion of the number to the right of the radix point (p-1 p-2 p-m) is
called the fractional part, and the portion to the left of the radix point (pnpn+1 p0 ) is called the
integral part. Numbers expressed in base 2 are called binary numbers. They are often used in
computers since they require only two coefficient values. The integers from 0 to 15 are given in Table
below for several bases. Since there are no coefficient values for the range 10 to b 1 when b > 10,
the letters A, B, C, . . . are used. Base-8 numbers are called octal numbers, and base-16 numbers are
called hexadecimal numbers. Octal and hexadecimal numbers are often used as a shorthand for
binary numbers. An octal number can be converted into a binary number by converting each of the
octal coefficients individually into its binary equivalent. The same is true for hexadecimal numbers.
This property is true because 8 and 16 are both powers of 2. For numbers with bases that are not a
power of 2, the conversion to binary is more complex.
Base
(N)b
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
001
002
010
011
012
020
021
022
100
101
102
110
111
112
120
01
02
03
10
11
12
13
20
21
22
23
30
31
32
33
01
02
03
04
10
11
12
13
14
20
21
22
23
24
30
....
..... 10
11
12
16
01
02
03
04
05
06
07
10
11
12
13
14
15
16
17
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
01
02
03
04
05
06
07
08
09
0A
10
11
12
13
14
01
02
03
04
05
06
07
08
09
0A
0B
10
11
12
13
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
In converting (N)10 to (N)b the fraction and integer parts are converted separately. First, consider
the integer part (portion to the left of the decimal point). The general conversion procedure is to
divide (N)10 by b, giving (N)10/b and a remainder. The remainder, call it p0 , is the least significant
(rightmost) digit of (N)b. The next least significant digit, p1 , is the remainder of (N)10/b divided by b,
and succeeding digits are obtained by continuing this process. A convenient form for carrying out this
conversion is illustrated in the following example.
2
2
2
2
2
23
11
5
2
1
0
(Remainder)
1
1
1
0
1
(Remainder)
7
2
c) (410)10 = (3120)5
5
5
5
5
410
82
16
3
0
(Remainder)
0
2
1
3
Now consider the portion of the number to the right of the decimal point, i.e., the fractional part. The procedure for
converting this is to multiply (N)10 (fractional) by b. If the resulting product is less than 1, then the most significant
(leftmost) digit of the fractional part is 0. If the resulting product is greater than 1, the most significant digit of the
fractional part is the integral part of the product. The next most significant digit is formed by multiplying the
fractional part of this product by b and taking the integral part. The remaining digits are formed by repeating this
11
process. The process may or may not terminate. A convenient form for carrying out this conversion is illustrated
below.
(a)
(0.625)10 = (0.5)8
0.625 x 8 = 5.000
0.5
0.23 x 2 = 0.46
0.46 x 2 = 0.92
0.92 x 2 = 1.84
0.84 x 2 = 1.68
0.68 x 2 = 1.36
0.36 x 2 = 0.72
0.0
0.00
0.001
0.0011
0.00111
0.001110
0.1
0.10
0.101
0.1010
0.10101
0.101011
0.5
0.53
This example illustrates the simple relationship between the base-2 (binary) system and the base-8 (octal)
system. The binary digits, called bits, are taken three at a time in each direction from the binary point and are
expressed as decimal digits to give the corresponding octal number. For example, 101 in binary is equivalent
to 5 in decimal; so the octal number in part (c) above has a 5 for the most significant digit of the fractional
part. The conversion between octal and binary is so simple that the octal expression is sometimes used as a
convenient shorthand for the corresponding binary number.
When a fraction is converted from one base to another, the conversion may not terminate, since it may not be
possible to represent the fraction exactly in the new base with a finite number of digits. For example, consider
the conversion of (0.1)3 to a base-10 fraction. The result is clearly (0.333 )10, which can be written as ( 0.3 )10
to indicate that the 3's are repeated indefinitely. It is always possible to represent the result of a conversion of
base in this notation, since the non-terminating fraction must consist of a group of digits which are repeated
indefinitely. For example, (0.2)11 = 2 x 11-1 = (0.1818 )10 = ( 0.
1818 )10 .
It should be pointed out that by combining the two conversion methods it is possible to convert between any
two arbitrary bases by using only arithmetic of a third base. For example, to convert (16)7 to base 3, first
convert to base 10,
(16)7 = 1X71 + 6X70 = 7 + 6 = (13)10
Then convert (13)10 to base 3,
3
3
3
3
13
4
1
0
(Remainder)
1
1
1
Binary Addition
The binary addition table is as follows:
Sum Carry
0+0= 0
0
0+1= 1
0
1+0= 1
0
1+1= 0
1
Addition is performed by writing the numbers to be added in a column with the binary points aligned. The
individual columns of binary digits, or bits, are added in the usual order according to the above addition table.
Note that in adding a column of bits, there is a 1 carry for each pair of 1's in that column. These 1 carries are
treated as bits to be added in the next column to the left. A general rule for addition of a column of numbers
(using any base) is to add the column decimally and divide by the base. The remainder is entered as the sum
for that column, and the quotient is carried to be added in the next column.
Base 2
Carries:
10011 11
1001.011 = (9.375)10
1101.101 =(13.625)10
10111.000 = (23)10 = Sum
Binary Subtraction
The binary subtraction table is as follows:
Difference
Borrow
0-0=0
0
0-1=1
1
1-0=1
0
1-1=0
0
Subtraction is performed by writing the minuend over the subtrahend with the binary points aligned and
carrying out the subtraction according to the above table. If a borrow occurs and the next leftmost digit of the
minuend is a 1, it is changed to a 0 and the process of subtraction is then continued from right to left.
Base 2
Base 10
Borrow:
1
0
Minuend
10
2
Subtrahend
- 01
-1
------------------------------Difference
01
1
------------------------------If a borrow occurs and the next leftmost digit of the minuend is a 0, then this 0 is changed to a 1, as is each
successive minuend digit to the left which is equal to 0. The first minuend digit to the left which is equal to 1 is
changed to 0, and then the subtraction process is resumed.
Base 2
Base 10
Borrow:
Minuend
1
Subtrahend - 1
Difference
0
0
1
0
0
1
0
0
1
1
1
0
0
1
0
1
1
Base 2
Borrow:
0
Minuend
1
Subtrahend - 0
Difference
0
24
-17
7
Base 10
1
1
0
1
0
0
1
1
1
1
1
0
0
1
1
0 0
0 1
1 1
40
-25
15
Sign-and-magnitude method
One may first approach the problem of representing a number's sign by allocating one sign bit to represent
the sign: set that bit (most significant bit) to 0 for a positive number, and set to 1 for a negative number. The
remaining bits in the number indicate the magnitude (or absolute value). Hence in a byte with only 7 bits
(apart from the sign bit), the magnitude can range from 0000000 (0) to 1111111 (127). Thus you can represent
numbers from 12710 to +12710 once you add the sign bit (the eight bit). A consequence of this representation
is that there are two ways to represent zero, 00000000 (0) and 10000000 (0). Decimal 43 encoded in an
eight-bit byte this way is 10101011. This approach is directly comparable to the common way of showing a
sign (placing a "+" or "" next to the number's magnitude). Some early binary computers (e.g. IBM 7090) used
this representation, perhaps because of its natural relation to common usage. Sign-and-magnitude is the most
common way of representing the significand in floating point values.
Binary
Signed Unsigned
00000000 +0
00000001 1
...
...
...
01111111 127
127
10000000 0
128
10000001 1
129
...
...
...
11111111 127
255
Ones' complement
Alternatively, a system known as ones' complement can be used to represent negative numbers. The ones'
complement form of a negative binary number is the bitwise NOT applied to it the "complement" of its
positive counterpart. Like sign-and-magnitude representation, ones' complement has two representations of
0: 00000000 (+0) and 11111111 (0).
The sum of an n-bit number and its complement is zero. Negative(X)=(2^N 1) - X The negative of a
1s complement number is found by inverting each bit, 0 to 1 and 1 to 0. Problem is this scheme has
two values for zero. Finding a negative number is easy and only requires a bit wise complement
operation. However, an addition which produces a carry requires an extra add operation for the
carry.
As an example, the ones' complement form of 00101011 (43) becomes 11010100 (43). The range of signed
numbers using ones' complement is represented by (2N11) to (2N11) and +/0. A conventional eight-bit
byte is 12710 to +12710 with zero being either 00000000 (+0) or 11111111 (0).
10000001 126
10000010 125
130
...
...
Binary
value
Ones'
complement
interpretation
00000000 +0
00000001 1
...
...
01111101 125
01111110 126
01111111 127
10000000 127
...
11111101 2
253
11111110 1
254
11111111 0
255
Complement/Negate
2s complement Representation:
The sum of an n-bit number and its 2s complement is zero. Negative(X) = (2^N) -X = ((2^N 1)-X)+1.
2s complement = 1s complement + 1. Only problem is the range is not symmetric. There is one
more negative number than positive. The negative of a 2s complement number is found by inverting
each bit, then adding 1. Only problem is the range is not symmetric. There is one more negative
number than positive.
unsigned
Sign magnitude
1s complement
1111 [15]
1110
1101
1100
1011
1010
1001
1000
0111
0110
0101
0100
0011
0010
0001
0000 [0]
0111 [7]
0110
0101
0100
0011
0010
0001
0000, 1000[-0]
1001
1010
1011
1100
1101
1110
1111 [-7]
0111 [7]
0110
0101
0100
0011
0010
0001
0000, 1000[-0]
1110
1101
1100
1011
1010
1001
1000 [-7]
Complement/Negate
01011101
number
10100010
invert bits
10100010 + 1 add 1
10100011
2s Complement
01011101
10100011
1 00000000
2s
complement
0111 [7]
0110 [6]
0101 [5]
0100 [4]
0011 [3]
0010 [2]
0001 [1]
0000 [0]
1111 [-1]
1110 [-2]
1101 [-3]
1100 [-4]
1011 [-5]
1010 [-6]
1001 [-7]
1000 [-8]
Addition
0100
1101
1 0001
number
2s Complement
(discard carrys in 2s complement arithmetic)
[+4]
[-3]
[+1] [ignore carry]
0100
1011
0 1111
[+4]
[-5]
[-1] [no carry]
Unsigned Arithmetic
a) Use: in address calculation
b) No negative values
c) No sign extension for word size conversion
d) Validity: only produced carry
( = unsigned overflow = unsigned out-of-range)
1110
1111 1110
1111 1111 1111 1110
1111 1111 1111 1111 1111 1111 1111 1110
[-2]
[-2] byte
[-2] half word
[-2] word
(register)
[+4]
[+5]
[-7] (9)
1100 [-4]
1011 [-5]
1 0111 [+7] (-9)
Carry/Borrow:
a) Occurs during the addition of two unsigned numbers when a carry propagates from the Msbit
of the result.
b) Normally an error for unsigned arithmetic
c) Basis for extended word precision. Words are added/subtracted from LSW to MSW with the
carry from the previous word.
d) Extended word precision for signed number is identical but the MSW addition/subtraction step
uses signed arithmetic.
e) Example:
1100 [12]
1011 [11]
0001 0111 [23]
(16 + 7)
a
b
c
Questions
What is the Gray code? What are the rules to construct Gray code? Develop the 4 bit Gray
code for the decimal 0 to 15.
List the XS3 code for decimal 0 to 9
What are the rules for XS3 addition? Add the two decimal numbers 123 and 658 in XS3
code.
Test if these code words are correct, assuming they were created using an even parity
Hamming Code . If one is incorrect, indicate what the correct code word should have been.
Also, indicate what the original data was.
010101100011
111110001100
000010001010
Why the binary number system is used in computer design?
Given the binary numbers a = 1010.1, b = 101.01, c =1001.1 perform the following:
i. a + c
ii.a - b
iii. a. c
Convert (2AC5.D)16 to binary and then to octal
a
b
c
4
a
b
c
5
7
8
9
10
a
b
11
12
13
14
Check and find if any error in the received message. The message was coded by Hamming
code method 0111001
Write the 32 bit pattern that your computer stores number (-2) if it uses i) 1s complement
method ii) 2s complement method iii) Signed magnitude method
Make a table for 4 bit binary data representation in i) unsigned ii) Sign magnitude iii) 1s
complement iv) 2s complement
The given data
A = (AC)16 B = (7D)16 C = (F3)16; Find A+B, A+B+C, A-C, A-B
In each case i) if A,B,C are i) Sign magnitude ii) 2s complement iii) Unsigned magnitude
using binary arithmetic only.