Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa....

65
Chapter 3 Number Representation

Transcript of Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa....

Page 1: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Chapter 3

NumberRepresentation

Page 2: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Convert a number from decimal to binary notation andConvert a number from decimal to binary notation andvice versa.vice versa.Understand the different representations of an integer insideUnderstand the different representations of an integer insidea computer: a computer: unsignedunsigned, , sign-and-magnitudesign-and-magnitude, , one’s complementone’s complement, , and and two’s complementtwo’s complement..

Understand the Excess system that is used to store the Understand the Excess system that is used to store the exponential part of a exponential part of a floating-point numberfloating-point number..

After reading this chapter, the reader should After reading this chapter, the reader should be able to :be able to :

OOBJECTIVESBJECTIVES

Understand how floating numbers are stored inside a computerUnderstand how floating numbers are stored inside a computerusing the using the exponentexponent and the and the mantissamantissa. .

Page 3: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

DECIMALDECIMALANDAND

BINARYBINARY

DECIMALDECIMALANDAND

BINARYBINARY

3.13.1

Page 4: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-1 Decimal system

Page 5: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-2

Binary system

Page 6: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

CONVERSIONCONVERSIONCONVERSIONCONVERSION

3.23.2

Page 7: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-3

Binary to decimal conversion

Page 8: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 1Example 1

Convert the binary number 10011 to decimal.

SolutionSolution

Write out the bits and their weights. Multiply the bit by its corresponding weight and record the result. At the end, add the results to get the decimal number.

Binary 1 0 0 1 1Weights 16 8 4 2 1

----------------------------------------- 16 + 0 + 0 + 2 + 1 Decimal 19

Page 9: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 2Example 2

Convert the decimal number 35 to binary.

SolutionSolution

Write out the number at the right corner. Divide the number continuously by 2 and write the quotient and the remainder. The quotients move to the left, and the remainder is recorded under each quotient. Stop when the quotient is zero.

0 1 2 4 8 17 35 Dec.

Binary 1 0 0 0 1 1

Page 10: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-4 Decimal to binary conversion

Page 11: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

INTEGERINTEGERREPRESENTATIONREPRESENTATION

INTEGERINTEGERREPRESENTATIONREPRESENTATION

3.43.4

Page 12: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-5

Range of integers

Page 13: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-6

Taxonomy of integers

Page 14: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.1 Range of unsigned integersTable 3.1 Range of unsigned integers

# # of Bits of Bits ---------

816

RangeRange-------------------------------------0 2550 65,535

• Unsigned integer - an integer without a sign. • Range: 0 … ( 2N – 1 )

Unsigned integers format

Page 15: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 3Example 3

Store 7 in an 8-bit memory location.

SolutionSolution

1.1. First change the number to binary First change the number to binary 111111. .

2.2. Add five 0s to make a total of N (8) Add five 0s to make a total of N (8) bits, bits, 0000000000111111. The number is stored . The number is stored in the memory location.in the memory location.

Page 16: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 4Example 4

Store 258 in a 16-bit memory location.

SolutionSolution

1.1. First change the number to binary First change the number to binary 100000010100000010. .

2.2. Add seven 0s to make a total of N (16) bits, Add seven 0s to make a total of N (16) bits, 00000000000000100000010100000010. The number is stored in . The number is stored in the memory location.the memory location.

Page 17: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.2 Example of storing Table 3.2 Example of storing unsigned integersunsigned integers in in two different computerstwo different computers

DecimalDecimal------------

7234258

24,7601,245,678

8-8-bit allocationbit allocation------------0000011111101010overflowoverflowoverflow

16-16-bit allocationbit allocation------------------------------

0000000000000111000000001110101000000001000000100110000010111000

overflow

Page 18: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

overflow error overflow error

An error that occurs when the computer attempts to handle a number that is too large for it.

Every computer has a well-defined range of values that it can represent. If during execution of a program it arrives at a number outside this range, it will experience an overflow error.

Page 19: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 5Example 5

Interpret 00101011 in decimal if the number was stored as an unsigned integer.

SolutionSolution

Using the procedure shown in Using the procedure shown in Figure 3.3 , the number in Figure 3.3 , the number in decimal is decimal is 4343. .

Page 20: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• leftmost bit – represent the sign bit S 0 for positive 1 for negative

• Range: -( 2N-1 – 1 ) … +( 2N-1 – 1 )

Sign-and-magnitude format

S bN-2 … … … … … … … b1 b0

Page 21: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

There are two 0s in sign-and-There are two 0s in sign-and-magnitude magnitude

representation: positive and representation: positive and negative.negative.

In an 8-bit allocation:In an 8-bit allocation:

+0 +0 00000000 00000000-0 -0 10000000 10000000

NoteNote::

Page 22: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.3 Range of sign-and-magnitude integersTable 3.3 Range of sign-and-magnitude integers

# # of Bits of Bits ----------

81632

127 032767 0 0

+0 +127 +0 +32767 +0 +2,147,483,647

RangeRange--------------------------------------------------------------------------------------------------------------

Page 23: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

In sign-and-magnitude representation, In sign-and-magnitude representation, the the leftmost bitleftmost bit defines the defines the signsign of the of the number. number.

If it is If it is 00, the number is , the number is positivepositive..

If it is If it is 11, the number is , the number is negativenegative. .

NoteNote::

Page 24: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 6Example 6

Store +7 in an 8-bit memory location using sign-and-magnitude representation.

SolutionSolution

First change the number to binary 111. First change the number to binary 111. Add four 0s to make a total of Add four 0s to make a total of N-1 (7) bitsN-1 (7) bits, , 00001110000111. Add . Add an extra zeroan extra zero because the because the number is number is positivepositive. . The result is: The result is:

0000000000111111

Page 25: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 7Example 7

Store –258 in a 16-bit memory location using sign-and-magnitude representation.

SolutionSolution

First change the number to binary 100000010. First change the number to binary 100000010. Add six 0s to make a total of N-1 (15) bits, Add six 0s to make a total of N-1 (15) bits, 000000100000010000000100000010. Add an extra 1 because . Add an extra 1 because the number is negative. the number is negative.

The result is: The result is: 11000000000000100000010100000010

Page 26: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.4 Example of storing sign-and-magnitude Table 3.4 Example of storing sign-and-magnitude integers in two computers integers in two computers

DecimalDecimal------------

+7-124+258

-24,760

8-8-bit allocationbit allocation------------0000011111111100overflowoverflow

16-16-bit allocationbit allocation------------------------------

0000000000000111100000000111110000000001000000101110000010111000

Page 27: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 8Example 8

Interpret 10111011 in decimal if the number was stored as a sign-and-magnitude integer.

SolutionSolution

Ignoring the leftmost bit, the remaining Ignoring the leftmost bit, the remaining bits are 0111011. This number in decimal bits are 0111011. This number in decimal is 59. The leftmost bit is 1, so the number is 59. The leftmost bit is 1, so the number is is –59–59..

Page 28: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• to represent a positive number unsigned integer

• to represent a negative number complete the positive number

• Range: -( 2N-1 – 1 ) … +( 2N-1 – 1 )

one’s complement format

Page 29: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

There are There are two 0stwo 0s in one’s in one’s complementcomplement

representation: positive and representation: positive and negative.negative.

In an 8-bit allocation:In an 8-bit allocation:

+0 +0 00000000 00000000-0 -0 11111111 11111111

NoteNote::

Page 30: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.5 Range of one’s complement integersTable 3.5 Range of one’s complement integers

# # of Bits of Bits ---------

81632

127 032767 0 0

+0 +127+0 +32767+0 +2,147,483,647

RangeRange--------------------------------------------------------------------------------------------------------------

Page 31: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

In one’s complement representation, In one’s complement representation, the the leftmostleftmost bit bit defines the defines the signsign of the of the number. number.

If it is If it is 00, the number is , the number is positivepositive..

If it is If it is 11, the number is , the number is negativenegative. .

NoteNote::

Page 32: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 9Example 9

Store +7 in an 8-bit memory location using one’s complement representation.

SolutionSolution

First change the number to binary 111. First change the number to binary 111. Add five 0s to make a total of N (8) bits, Add five 0s to make a total of N (8) bits, 0000011100000111. The sign is positive, so no . The sign is positive, so no more action is needed. The result is: more action is needed. The result is:

0000011100000111

Page 33: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 10Example 10

Store –258 in a 16-bit memory location using one’s complement representation.

SolutionSolution

First change the number to binary 100000010. First change the number to binary 100000010. Add seven 0s to make a total of N (16) bits, Add seven 0s to make a total of N (16) bits, 00000001000000100000000100000010. The sign is negative, so . The sign is negative, so each bit is complementedeach bit is complemented. .

The result is: The result is: 11111110111111011111111011111101

Page 34: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.6 Example of storing one’s complement Table 3.6 Example of storing one’s complement integers in two different computersintegers in two different computers

DecimalDecimal------------

8-8-bit allocationbit allocation------------00000111111110000111110010000011overflowoverflow

16-16-bit allocationbit allocation------------------------------

000000000000011111111111111110000000000001111100111111111000001101100000101110001001111101000111

Page 35: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 11Example 11

Interpret 11110110 in decimal if the number was stored as a one’s complement integer.

SolutionSolution

1.1. The leftmost bit is The leftmost bit is 11, so the number is , so the number is negativenegative. .

2.2. First First complementcomplement it . The result is it . The result is 0000100100001001. .

3.3. The complement in decimal is The complement in decimal is 99. .

4.4. So the original number was So the original number was –9–9. .

• Note that complement of a complement is the Note that complement of a complement is the original number.original number.

Page 36: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

•One’s complementOne’s complement means means reversing all bitsreversing all bits. .

•If you one’s complement a If you one’s complement a positivepositive number, number, you get the corresponding you get the corresponding negativenegative number. number.

•If you one’s complement a If you one’s complement a negativenegative number, number, you get the corresponding you get the corresponding positivepositive number. number.

•If you If you one’s complementone’s complement a number a number twicetwice, , you get the you get the original numberoriginal number. .

NoteNote::

Page 37: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• Storing two’s complement :1. The number is change to binary2. 0s are added to the left so that there is a

total of N bits.3. If the sign is negative, leave all the

rightmost 0s and the first 1 unchanged. Complete the rest of the bits.

• Range: -( 2N-1) … +( 2N-1 – 1 )

two’s complement format

Page 38: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Two’s complementTwo’s complement is is the most common, the most important, the most common, the most important, and the most widely used and the most widely used representation of integersrepresentation of integers today. today.

NoteNote::

Page 39: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.7 Range of two’s complement integersTable 3.7 Range of two’s complement integers

# # of Bits of Bits ---------

81632

128 32,768

0 +1270 +32,7670 +2,147,483,647

RangeRange--------------------------------------------------------------------------------------------------------------

Page 40: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

In two’s complement representation, In two’s complement representation, the the leftmostleftmost bit bit defines the defines the signsign of the of the number. number.

If it is If it is 00, the number is , the number is positivepositive..If it is If it is 11, the number is , the number is negativenegative. .

NoteNote::

Page 41: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 12Example 12

Store +7 in an 8-bit memory location using two’s complement representation.

SolutionSolution

First change the number to binary 111. First change the number to binary 111. Add five 0s to make a total of N (8) bits, Add five 0s to make a total of N (8) bits, 0000011100000111..The sign is positive, so no more action is The sign is positive, so no more action is needed. needed.

The result is: The result is:

0000011100000111

Page 42: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 13Example 13

Store –40 in a 16-bit memory location using two’s complement representation.

SolutionSolution

1.1. First change the number to binary First change the number to binary 101000101000. .

2.2. Add ten 0s to make a total of N (16) bits, Add ten 0s to make a total of N (16) bits, 00000000001010000000000000101000. .

3.3. The sign is negative, The sign is negative, so leave the so leave the rightmost 0s up to the first 1 rightmost 0s up to the first 1 (including the 1) unchanged(including the 1) unchanged and complement and complement the rest. The result is: the rest. The result is: 11111111110111111111110110001000

Page 43: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.8 Example of storing two’s complement Table 3.8 Example of storing two’s complement integers in two different computers integers in two different computers

DecimalDecimal------------

8-8-bit allocationbit allocation------------00000111111110010111110010000100overflowoverflow

16-16-bit allocationbit allocation------------------------------

000000000000011111111111111110010000000001111100111111111000010001100000101110001001111101001000

Page 44: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

There is There is only one 0only one 0 in two’s in two’s complement: complement:

In an 8-bit allocation:In an 8-bit allocation:

0 0 0000000000000000

NoteNote::

Page 45: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 14Example 14

Interpret 11110110 in decimal if the number was stored as a two’s complement integer.

SolutionSolution

1.1. The leftmost bit is The leftmost bit is 11. The number is . The number is negativenegative..

2.2. Leave Leave 1010 at the right alone at the right alone and and complement complement the rest. The result is 000010the rest. The result is 0000101010. .

3.3. The two’s complement number is 10. The two’s complement number is 10.

4.4. So the original number was So the original number was –10–10..

Page 46: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

•Two’s complementTwo’s complement can be achieved by can be achieved by reversing all bitsreversing all bits except except the rightmost bits up the rightmost bits up to the first 1 (inclusive). to the first 1 (inclusive).

•If you two’s complement a If you two’s complement a positivepositive number, number, you get the corresponding you get the corresponding negativenegative number. number.

•If you two’s complement a If you two’s complement a negativenegative number, number, you get the corresponding you get the corresponding positivepositive number. number.

•If you two’s complement a number If you two’s complement a number twicetwice, , you get the you get the original numberoriginal number. .

NoteNote::

Page 47: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.9 Summary of integer representationTable 3.9 Summary of integer representation

Contents of Contents of MemoryMemory

------------0000000100100011010001010110011110001001101010111100110111101111

UnsignedUnsigned

------------------------00112233445566778899

101011111212131314141515

Sign-and-Sign-and-MagnitudeMagnitude

One’sOne’sComplementComplement

Two’sTwo’sComplementComplement

Page 48: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

EXCESSEXCESSSYSTEMSYSTEMEXCESSEXCESSSYSTEMSYSTEM

3.53.5

Page 49: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• Magic number A positive number used in the conversion

process Normally 2N-1 or 2N-1 – 1

• Representation1. Add the positive number2. Change to binary

• Interpretation1. Change to decimal2. Subtract the positive number

Excess system

Original integer

Excess-M

+ M

- M

Page 50: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 15Example 15

Represent –25 in Excess_127 using an 8-bit allocation.

SolutionSolution

First add 127 to get First add 127 to get 102102. This number . This number in binary is 1100110. Add one bit to in binary is 1100110. Add one bit to make it 8 bits in length. The make it 8 bits in length. The representation is representation is 0110011001100110..

Page 51: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 16Example 16

Interpret 11111110 if the representation is Excess_127.

SolutionSolution

First change the number to decimal. First change the number to decimal. It is It is 254254. Then . Then subtract 127subtract 127 from the from the number. The result is decimal number. The result is decimal 127127..

Page 52: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

FLOATING-POINTFLOATING-POINTREPRESENTATIONREPRESENTATIONFLOATING-POINTFLOATING-POINTREPRESENTATIONREPRESENTATION

3.53.5

Page 53: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• Floating-Point number Integer fraction

• Convert a floating-point number to binary1. Convert the integer to binary2. Convert the fraction to binary3. Put a decimal point between the two parts.

Floating-Point Representation

Page 54: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-7

Changing fractions to binary

Page 55: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 17Example 17

Transform the fraction 0.875 to binary

SolutionSolution

Write the fraction at the left corner. Write the fraction at the left corner. MultiplyMultiply the number continuously by 2 the number continuously by 2 and and extract the integer partextract the integer part as the binary as the binary digit. Stop when the number is 0.0.digit. Stop when the number is 0.0.

0.875 1.750 1.5 1.0 0.0

0 . 1 1 1

Page 56: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 18Example 18

Transform the fraction 0.4 to a binary of 6 bits.

SolutionSolution

Write the fraction at the left cornet. Multiply Write the fraction at the left cornet. Multiply the number continuously by 2 and extract the the number continuously by 2 and extract the integer part as the binary digit. integer part as the binary digit. You can never get the You can never get the exactexact binary binary representation.representation. Stop when you have 6 bits. Stop when you have 6 bits.

0.4 0.8 1.6 1.2 0.4 0.8 1.6

0 . 0 1 1 0 0 1

Page 57: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• We need a standard representation of floating-point number

• Normalization the moving of the decimal point so that there

is only one 1 to the left of the decimal point. 1.xxxxxxxxxxxx

Multiply 2e, where e is the number of bits that the decimal point moved positive for left movement negative for right movement

Normalization

Page 58: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.10 Example of normalizationTable 3.10 Example of normalization

Original NumberOriginal Number------------

+1010001.1101-111.000011

+0.00000111001-001110011

MoveMove------------

6 26 3

Original NumberOriginal Number------------

Normalized ------------ xxxx

Page 59: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• A normalized number Sign Exponent

The movement of decimal point Excess representation # of bits - define the range

Mantissa Binary number to the right of decimal point # of bits - define the precision

• Note: the 1 to the left of decimal point is not stored; it is understood.

• + 26 x 1.0001110101 Sign : + Exponent : 6 Mantissa : 0001110101

Normalization

Page 60: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Figure 3-8

IEEE standards for floating-point representation

Page 61: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 19Example 19

Show the representation of the normalized number + 26 x 1.01000111001

SolutionSolution

•The The signsign is positive. is positive.

•The The Excess_127Excess_127 representation of the representation of the exponentexponent is is 133. 133.

•You add extra 0s on the right to make it 23 bits. You add extra 0s on the right to make it 23 bits. The number in memory is stored as:The number in memory is stored as:

00 10000101 10000101 0100011100101000111001000000000000000000000000

Page 62: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Table 3.11 Example of floating-point representationTable 3.11 Example of floating-point representation

SignSign----101

Mantissa-------------------------------

110000110000000000000001100100000000000000000011001100000000000000000

Number ------------ -22 x 1.11000011+2-6 x 1.11001-2-3 x 1.110011

ExponentExponent-----------100000010111100101111100

Page 63: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

Example 20Example 20

Interpret the following 32-bit floating-point number

1 01111100 11001100000000000000000

SolutionSolution

•The sign is The sign is negativenegative. .

•The exponent is –3 (The exponent is –3 (124 – 127124 – 127). ).

•The number after normalization isThe number after normalization is -2-2-3-3 x x 11.110011.110011

Page 64: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

HEXADECIMALHEXADECIMALNOTATIONNOTATION

HEXADECIMALHEXADECIMALNOTATIONNOTATION

3.63.6

Page 65: Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.

• 81.562581.5625

• +1010001.11001+1010001.11001

• +2+266 x 1.01000111001 x 1.01000111001

• 0 10000101 0 10000101 0100011100101000111001000000000000000000000000

• x 4 2 A 3 9 0 0 0x 4 2 A 3 9 0 0 0