Numbering Systems Used in Computers

 < Day Day Up > 

Three numbering systems are used in computers: decimal , binary , and hexadecimal . Decimal is also known as base 10. Binary is also known as base 2, and hexadecimal is also known as base 16. Here's an illustration to help you remember the basic differences between them.

You already are familiar with the decimal system: Look at your hands. Now, imagine your fingers are numbered from 09, for a total of 10 places. Decimal numbering is sometimes referred to as base 10.

The binary system doesn't use your fingers; instead, you count your hands: One hand represents 0, and the other 1, for a total of two places. Thus, binary numbering is sometimes referred to as base 2.

The hexadecimal system could be used by a pair of spiders who want to count: One spider's legs would be numbered 07, and the other spider's legs would be labeled 8, 9, AF to reach a total of 16 places. Hexadecimal numbering is sometimes referred to as base 16.

Decimal Numbering System

We use the decimal or base 10 system for everyday math. A variation on straight decimal numbering is to use "powers of 2" as a shortcut for large values. For example, drive storage sizes often are defined in terms of decimal bytes, but the number of colors that a video card can display can be referred to as "24-bit" (or 2 24 ), which is the same as 16,777,216 colors.

tip

graphics/tip_icon.gif

Although all data in the computer is stored as a stream of binary values (0s and 1s), most of the time you will use decimal ("512MB of RAM") or hexadecimal ("memory conflict at C800 in upper memory") measurements. The typical rule of thumb is to use the system that produces the smallest meaningful number. If you need to convert between these systems, you can use any scientific calculator, including the Windows Calculator program (select View, Scientific from the menu).


Binary Numbering System

All data is stored in computers in a stream of 1s (on) and 0s (off). Because only two characters (0 and 1) are used to represent data, this is called a "binary" numbering system. Text is converted into its numerical equivalents before it is stored, so binary coding can be used to store all computer data and programs.

Table 3.1 shows how you would count from 1 to 10 (decimal) in binary.

Table 3.1. Decimal Numbers 110 and Binary Equivalents

Decimal

1

2

3

4

5

6

7

8

9

10

Binary

1

10

11

100

101

110

111

1000

1001

1010

Because even a small decimal number occupies many places if expressed in binary, binary numbers are usually converted into hexadecimal or decimal numbers for calculations or measurements.

tip

graphics/tip_icon.gif

Table 3.2 provides a listing of powers of 2, but you can use the Windows Calculator in scientific view mode to calculate any power of two you want. Just enter 2, click the x^y button, and enter the value for the power of 2 you want to calculate (such as 24). The results are displayed instantly (you add the commas). Use the Edit menu to copy the answer to the Windows Clipboard, and use your program's Paste command to bring it into your document. Sure beats counting on your fingers!


There are several ways to convert a decimal number into binary:

  • Use a scientific calculator with conversion.

  • Use the division method.

  • Use the subtraction method.

To use the division method

  1. Divide the number you want to convert by 2.

  2. Record the remainder: If there's no remainder, enter 0. If there's any remainder, enter 1.

  3. Divide the resulting answer by 2 again.

  4. Repeat the process, recording the remainder each time.

  5. Repeat the process until you divide 0 by 2. This is the last answer.

  6. When the last answer is divided, the binary is recorded from Least Significant Bit (LSB) to Most Significant Bit (MSB). Reverse the order of bit numbers so that MSB is recorded first and the conversion is complete. For example, to convert the decimal number 115 to binary using the division method, follow the procedure listed in Figure 3.1.

    Figure 3.1. Converting decimal 115 to binary with the division method.

    graphics/03fig01.gif

If you use a scientific calculator (such as the scientific mode of the Windows Calculator) to perform the conversion, keep in mind that any leading zeros will be suppressed. For example, the calculation in Figure 3.1 indicates the binary equivalent of 115 decimal is 01110011. However, a scientific calculator will drop the leading zero and display the value as 1110011.

graphics/note_icon.gif

Once you understand how binary numbering works, you can appreciate a joke going the rounds on the Internet and showing up on T-shirts near you:

"There are 10 kinds of people in the worldthose who understand binary and those who don't." T-shirts are available from Think Geek (www. thinkgeek .com).


To use the subtraction method

  1. Look at the number you want to convert and determine the smallest power of 2 that is greater than or equal to the number you want to subtract. Table 3.2 lists powers of 2 from 2 through 2 17 . For example, 115 decimal is less than 2 7 (128) but greater than 2 6 (64).

  2. Subtract the highest power of 2 from the value you want to convert. Record the value and write down binary 1.

  3. Move to the next lower power of 2. If you can subtract it, record the result and also write down binary 1. If you cannot subtract it, write down binary 0.

  4. Repeat step 3 until you attempt to subtract 2 (1). Again, write down binary 1 if you can subtract it, or binary 0 if you cannot. The binary values (0 and 1) you have recorded are the binary conversion for the decimal number. Unlike the division method, this method puts them in the correct order; there's no need to write them down in reverse order.

For example, to convert 115 decimal to binary using the subtraction method, see Figure 3.2.

Figure 3.2. Converting 115 decimal to binary with the subtraction method.

graphics/03fig02.gif

Table 3.2. Powers of 2

Power of 2

Decimal Value

Power of 2

Decimal Value

2

1

2 9

512

2 1

2

2 10

1024

2 2

4

2 11

2048

2 3

8

2 12

4096

2 4

16

2 13

8192

2 5

32

2 14

16384

2 6

64

2 15

32768

2 7

128

2 16

65536

2 8

256

2 17

131072

Hexadecimal Numbering System

A third numbering system used in computers is hexadecimal. Hexadecimal numbering is also referred to as base 16, a convenient way to work with data because 16 is also the number of bits in 2 bytes or 4 nibbles . Hexadecimal numbers use the digits 09 and letters AF to represent the 16 places (015 decimal). Hexadecimal numbers are used to represent locations in data storage, data access, and RAM. Table 3.3 shows how decimal numbers are represented in hex.

caution

graphics/caution_icon.gif

You might need to convert decimal to binary numbers for the A+ Certification exam, so try both pencil and paper methods (division and subtraction) and get comfortable with one of them.


Table 3.3. Decimal and Hexadecimal Equivalents

Decimal

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

Hexadecimal

1

2

3

4

5

6

7

8

9

A

B

C

D

E

F

To convert decimal to hexadecimal, use the same division method listed previously, but use 16 rather than 2 as the divisor.

Figure 3.3 demonstrates how to use this conversion process to convert the decimal number of 65,536 (the start of upper memory) to its hexadecimal equivalent (A0000).

Figure 3.3. Converting 65,536 decimal to hexadecimal.

graphics/03fig03.gif

Note that if you use the Windows Calculator in scientific mode to perform this conversion that you will get an answer of 100000. The initial value 10 is the numeric equivalent of hex A (refer to Table 3.3).

The most typical uses for hexadecimal numbering are

  • Upper memory addresses for add-on cards and for memory-management use

  • I/O port addresses for use with an add-on card

Binary Versus Decimal MB/GB

Although a byte represents the basic "building block" of storage and RAM calculation, most measurements are better performed with multiples of a byte. All calculations of the capacity of RAM and storage are done in bits and bytes . Eight bits is equal to one byte.

Table 3.4 provides the most typical values and their relationship to the byte.

Table 3.4. Decimal and Binary Measurements

Measurement

Type [*]

Number of Bytes/Bits

Calculations

Notes

Bit

 

1/8 of a byte

Byte/8

 

Nibble

 

1/2 of a byte

Byte/4 (4 bits)

 

Byte

 

8 bits

bit*8

 

Kilobit (Kb )

D

1,000 bits

   

Kibibit (Kib )

B

1,024 bits (128 bytes)

 

[1]

Kilobyte ( KB )

D

1,000 bytes

   

Kibibyte (KiB )

B

1,024 bytes

 

[2]

Megabit (Mb )

D

1,000,000 bits

1 kilobit [2]

 

Mebibit (Mib )

B

1,048,576 bits (131,072 bytes)

1 kibibit [2]

[3]

Megabyte ( MB )

D

1,000,000 bytes

1,000KB

 

Mebibyte (MiB )

B

1,048,576 bytes (1,024KiB)

1 kilobyte [2]

[4]

Gigabit (Gb )

D

1,000,000,000 bits

1 kilobit [3]

 

Gibibit (Gib )

B

1,073,741,824 bits

1 kibibit [3]

[5]

Gigabyte ( GB )

D

1,000,000,000 bytes

1 kilobyte [3]

 

Gibibyte (GiB )

B

1,073,741,824 bytes

1 kibibyte [3]

[6]

[*] D=Decimal B=Binary

[1] Also known as binary kilobit

[2] Also known as binary kilobyte

[3] Also known as binary megabit

[4] Also known as binary megabyte

[5] Also known as binary gigabit

[6] Also known as binary gigabyte

Until December 1998, the terms kilobit, kilobyte, megabit, megabyte, gigabit, and gigabyte were officially used to refer both to decimal and binary values. A great deal of confusion in the industry has been caused by the indiscriminate use of both types of measurements for hard disk storage. Although the binary multiples shown in Table 3.4 are an IEC standard, many vendors in the computer business don't yet use the term kibibits or other binary multiples yet.

Floppy and hard disk manufacturers almost always rate their drives in decimal megabytes (multiples of 1 million bytes) or decimal gigabytes (multiples of 1 billion bytes), which is also the standard used by disk utilities, such as CHKDSK, ScanDisk, and FORMAT. However, most BIOSs and the MS-DOS/Windows FDISK and Windows NT/2000/XP Disk Management utilities list drive sizes in mebibytes (binary megabytes) or gibibytes (binary gigabytes). Mebibytes are also used to specify the size of rewritable and recordable CD and DVD media. Although the actual number of bytes is identical, the differences in numbering are confusing.

tip

graphics/tip_icon.gif

Because the industry has not yet widely adopted the terms kibi, mebi, and gibi, the A+ Certification Exam might use KB, MB, and GB to refer to either type of numbering system.


Take a hard disk rated by its maker as 8.4GB. This is 8,400,000,000 bytes (decimal). However, when the drive is detected and configured by the BIOS and partitioned with FDISK, its size is listed as only 7.82GB (binary GBmore accurately referred to as GiB). At first glance, you might believe you've lost some capacity (see Figure 3.4).

Figure 3.4. The capacity of an 8.4GB hard disk size is 8.4 billion bytes (top bar), but most BIOSs and Windows FDISK/Disk Management measure drives in binary gigabytes (bottom bar).

graphics/03fig04.gif

However, as you've already seen, there is a substantial difference between the number of bytes in a binary gigabyte and one billion bytes. This different numbering system, not any loss of bytes, accounts for the seeming discrepancy. Use this information to help explain to a customer that the "missing" capacity of the hard disk isn't really missing (see Figure 3.5).

Figure 3.5. A gibibyte (or binary gigabyte) has over 73 million more bytes than a decimal gigabyte (1 billion bytes).

graphics/03fig05.gif

Use the values in Table 3.4 to convert between decimal and binary values for drive sizes or other measurements. For the exam, keep in mind that values that can be divided by 1,000 are decimal, while values that can be divided by 1,024 are binary.

 < Day Day Up > 


Absolute Beginners Guide to A+ Certification. Covers the Hardware and Operating Systems Exam
Absolute Beginners Guide to A+ Certification. Covers the Hardware and Operating Systems Exam
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 310

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net