Higher Engineering Mathematics, Sixth Edition

(Nancy Kaufman) #1

Chapter 10


Binary, octal and


hexadecimal


10.1 Introduction

All data in modern computers is stored as series ofbits,
abitbeingabinarydigit,andcanhaveoneoftwovalues,
the numbers 0 and 1. The most basic form of represent-
ing computer data is to represent a piece of data as a
string of 1’s and 0’s, one for each bit. This is called a
binaryor base-2 number.
Because binary notation requires so many bits to rep-
resent relatively small numbers, two further compact
notations are often used, calledoctalandhexadeci-
mal. Computer programmers who design sequences of
number codes instructing a computer what to do would
have a very difficult task if they were forced to work
with nothing but long strings of 1’s and 0’s, the ‘native
language’ of any digital circuit.
Octal notation represents data as base-8 numbers with
each digit in an octal number representing three bits.
Similarly, hexadecimal notation uses base-16 numbers,
representing four bits with each digit. Octal numbers
use only the digits 0–7, while hexadecimal numbers
use all ten base-10 digits (0–9) and the letters A–F
(representing the numbers 10–15).
This chapter explains how to convert between the
decimal, binary, octal and hexadecimal systems.


10.2 Binary numbers

The system of numbers in everyday use is thedenary
ordecimalsystem of numbers, using the digits 0 to 9.
Ithastendifferentdigits(0,1,2,3,4,5,6,7,8and9)
and is said to have aradixorbaseof 10.


Thebinarysystem of numbers has a radix of 2 and
uses only the digits 0 and 1.
(a) Conversion of binary to decimal

The decimal number 234.5 is equivalent to

2 × 102 + 3 × 101 + 4 × 100 + 5 × 10 −^1

i.e. is the sum of terms comprising: (a digit) multiplied
by (the base raised to some power).
In the binary system of numbers, the base is 2, so
1101.1 is equivalent to:

1 × 23 + 1 × 22 + 0 × 21 + 1 × 20 + 1 × 2 −^1

Thus the decimal number equivalent to the binary
number 1101.1 is 8+ 4 + 0 + 1 +^12 , that is 13.5 i.e.
1101.1 2 =13.5 10 , the suffixes 2 and 10 denoting binary
and decimal systems of numbers respectively.

Problem 1. Convert 11011 2 to a decimal number.

From above: 11011 2 = 1 × 24 + 1 × 23 + 0 × 22
+ 1 × 21 + 1 × 20
= 16 + 8 + 0 + 2 + 1

= (^2710)
Problem 2. Convert 0.1011 2 to a decimal
fraction.
0. 10112 = 1 × 2 −^1 + 0 × 2 −^2 + 1 × 2 −^3 + 1 × 2 −^4
= 1 ×
1
2



  • 0 ×
    1
    22

  • 1 ×
    1
    23

  • 1 ×
    1
    24

Free download pdf