25.08.2021 Views

082-Engineering-Mathematics-Anthony-Croft-Robert-Davison-Martin-Hargreaves-James-Flint-Edisi-5-2017

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

1.3 Number bases 17

Table1.4isusedtoexpresseachgroupoffourasitshexequivalent.Forexample,0111 =

7 16

, and continuing inthis waywe obtain

1AE7

Thus 110101110 0111 2

= 1AE7 16

.

1.3.4 Binarycodeddecimal

We have seen in Section 1.3.2 that decimal numbers can be expressed in an equivalent

binary form where the position of each binary digit, moving from the right to the left,

represents an increasing power of 2. There is an alternative way of expressing numbers

using the binary digits 1 and 0 that is often used in electronic engineering because for

some applications it is more straightforward to build the necessary hardware. This systemiscalledbinary

coded decimal(b.c.d.).

First of all, recall how the decimal digits 0,1,2,...,9 are expressed in their usual

binary form. Note that the largest decimal digit 9 is 1001 in binary, and so we need

at most four digits to store the binary representations of 0,1,...,9. Expressing each

decimal digitas a four-digitbinary number we obtain Table 1.5.

Table1.5

Decimal digits and their four-digit

binaryrepresentations.

0 0000 5 0101

1 0001 6 0110

2 0010 7 0111

3 0011 8 1000

4 0100 9 1001

A four-digit binary number is referred to as a nibble. To express a multi-digit decimal

number, such as 347, in b.c.d. each decimal digit in turn is converted into its binary

representation as shown. Note thatanibble isused foreach decimal digit.

3 4 7

↓ ↓ ↓

0011 0100 0111

Recall from Section 1.3.2 that a byte is a group of 8 bits (binary digits). Computers

usually store numbers in 8-bit bytes so there are two common ways of encoding b.c.d.

The first is to use a whole byte for each nibble, with the first 4 bits always set to 0. So,

forexample, 347 10

can be storedas

00000011 00000100 00000111

Alternatively, eachbytecanbeusedtostoretwonibbles,inwhichcase347 10

wouldbe

storedas

00000011 01000111

Ruleshavebeendevelopedforperformingcalculationsinb.c.d.butthesearebeyondthe

scope of thisbook.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!