Академический Документы
Профессиональный Документы
Культура Документы
Hexadecimal Numbers
The Hexadecimal system is a number system based on sixteen symbols and is a compact way
of expressing binary numbers. It is frequently used in microprocessor and computer
applications. The system is based on the ten decimal digits and on the first six alphabetic
characters. The subscript 16 is used to indicate that a number is Hexadecimal, for example,
1016.
COUNT
zero
one
two
three
four
five
six
seven
eight
nine
ten
eleven
twelve
thirteen
fourteen
fifteen
DECIMAL
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
BINARY
02
12
102
112
1002
1012
1102
1112
10002
10012
10102
10112
11002
11012
11102
11112
HEXADECIMAL.
016
116
216
316
416
516
616
716
816
916
A16
B16
C16
D16
E16
F16
As can be seen a four digit binary number represents each Hexadecimal number. Counting in
Hexadecimal is very similar also:
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,10,11,12,13,14,15,16,17,18,19,1A,1B,1C,1D,1E,1F,20,21.....
[398E16]
[4581610]
[28A16]
Floating-Point Numbers
The Floating-point number system, based on scientific notation, is capable of representing
very large and very small numbers without increasing the number of bits required. A
floating-point number consists of a three parts a sign bit, an exponent and a mantissa. The
mantissa represents the magnitude of the number and the exponent determines the position of
the decimal point.
Consider the decimal number
241,506,800
To represent this integer in floating-point, it must be normalised by moving the decimal point
to the left of all the digits leaving a fractional number (mantissa) and the exponent as follows:
0.2415068 10 9
S
1 bit
Mantissa (fraction, F)
8 bits
23 bits
sign bit
The range of floating point binary numbers that can be represented using single precision
(2 - 2 -23 ) 2127
~ 10 38.53
To evaluate a binary number, given the number in single precision floating point format
The Number in binary is given by:
1 S 1 F 2 E-127 2
where S is the sign bit (either 1 or 0)
F is the fractional part (mantissa) in binary
E is the biased exponent converted to decimal (The actual exponent is E-127)
Example
S
1
E
10010001
F
10001110001000000000000
1 * 20 = 1 * 1
0 * 21 = 0 * 2
0 * 22 = 0 * 4
0 * 23 = 0 * 8
1 * 24 = 1 * 16
0 * 25 = 0 * 32
0 * 26 = 0 * 64
1 * 27 = 1 * 128
Sum
Substitute into the single precision floating point formula:
The number (in binary) is
1 1.1000111000 1 2
1 1.1000111000 1 2145127
1
1
18
=1
=0
=0
=0
= 16
=0
=0
= 128
= 145
10
10
10
10
10
10
10
10
10
Multiplying a binary number by 218 is the same as shifting the binary point 18 places to the
right. (This is analogous to shifting the decimal point n positions to the right when a decimal
number is multiplied by 10 n .) Therefore the number is
1100011100 010000000 2
This number can be converted to decimal, by determining the weights in all of the bit
positions where the binary digit is 1, and adding them together. The number in decimal is
10
SUMMARY
Number Systems:
Decimal (10 digits): 0,1,2,3,4,5,6,7,8,9
Binary (2 digits):
0,1
Hexadecimal (16 digits):
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Octal (8 digits):
0,1,2,3,4,5,6,7
Decimal to Binary
conversion
Binary to Decimal
conversion
Binary Addition
Binary Subtraction
Binary Multiplication
Binary Division
1s complement
2s complement
2s complement = 1s complement + 12
Octal to Decimal
conversion
Decimal to Octal
conversion
Binary to Hexadecimal
Hexadecimal to Binary
Hexadecimal to Decimal
Decimal to Hexadecimal
[310]
[410]
[1110]
[3110]
Ex. 9
Convert the following binary numbers to decimal.
(a)
110011.112
(b)
1110001.00012
(c)
1011010.10102
[51.7510]
[113.062510]
[90.62510]
Ex. 10
What is the highest decimal number that can be represented by seven bits?
Ex. 11
How many bits are required to represent the following decimal numbers?
(a)
17
[5]
(b)
49
[6]
(c)
132
[8]
(d)
205
[8]
Ex. 12
Generate the binary sequence for the decimal sequence from 64 to 75.
Ex. 13
Convert the following decimal numbers to binary.
(a)
17
(b)
59
(c)
73
(d)
186
[100012]
[1110112]
[10010012]
[101110102]
Ex. 14
Convert each of the following decimal numbers to binary (to 6 binary places).
(a)
0.98
[0.1111102]
(b)
0.347
[0.0101102]
(c)
186.9028
[10111010.1110012]
Ex. 15
Determine the 1s complement of each binary number (assume 8-bit 1s complement).
110101112
(a)
11101012
(b)
Ex. 16
Determine the 2s complement of each binary number (assume 8-bit 2s complement).
110101112
(a)
11101012
(b)
Ex. 17
Express each decimal number in binary as an 8-bit number in 2s complement form.
(a)
68
[101111002]
(b)
+101
[011001012]
(c)
125
[100000112]
Ex. 18
Determine the decimal value of each signed binary number (assume 8-bit 2s
complement).
(a)
100110012
[-10310]
(b)
011101002
[11610]
(c)
101111112
[-6510]
Binary Arithmetic
Ex. 19
Add the following binary numbers.
(a)
10012 + 1012
(b)
11012 + 10112
[11102]
[110002]
Ex. 20
Convert each pair of decimal numbers to 8-bit binary in 2s complement form and
add.
(a)
33 and 15
[001100002]
(b)
56 and 27
[000111012]
(c)
46 and 25
[-000101012]
(d)
110 and 84
[OVERFLOW]
Ex. 21
Perform each addition (Each number is in 8-bit 2s complement form.)
(a)
100011002 + 001110012
[001110112]
(b)
110110012 + 111001112
[010000002]
Ex. 22
Perform each subtraction using 8-bit 2s complement.
(a)
001100112 000100002
(b)
011001012 111010002
[001000112]
[011111012]
Ex. 23
Multiply 011010102 by 111100012 (Each number is in 8-bit 2s complement form.)
[1001110010102 in 12-bit 2s complement form]
Ex. 24
Divide 01000100 by 00011001 (Each number is in 8-bit 2s complement form.)
[10.101110000101000111102 recurring]
Hexadecimal Numbers
Ex. 25
Convert each Hexadecimal number to binary
(a)
5916
(b)
FB1716
[010110012]
[11111011000101112]
[1716]
[98216]
[23510]
[147410]
[3416]
[11C16]
Ex. 26
Ex. 27
Ex. 28