• Aucun résultat trouvé

COMMON AREAS WHERE STUDENTS HAVE DIFFICULTIES

N/A
N/A
Protected

Academic year: 2022

Partager "COMMON AREAS WHERE STUDENTS HAVE DIFFICULTIES"

Copied!
10
0
0

Texte intégral

(1)

COMMON AREAS WHERE STUDENTS HAVE DIFFICULTIES

Students tend to have difficulty in the following areas:

w Understanding the difference between the complement operation and the

complementary representation. On exams, I've noticed that students tend to perform the complement operation even if the number given is already of correct sign.

Similarly, they have trouble knowing whether to complement a number when performing addition and subtraction

w Identifying overflow conditions, particularly when performing arithmetic w Understanding the end-around carry procedure, and the reason for it

w Finding the sign-and-magnitude equivalent of 2's or 10's complement negative numbers

EXERCISE SOLUTIONS

4.1 a. (BL2) Since an octal integer represents 3 bits, a six-digit octal number will represent an 18 bit number.

Positive 18 bit binary numbers are represented by values from 0 to 011111111111111111. Positive octal numbers range from 0 to 3777777. Since each group of three bits represent a single octal digit, there is an exact one-to-one relationship between these values. Similarly, negative values range from 111111111111111111 to 100000000000000000. Negative octal values range from 777777 to 400000. Again there is a direct correspondence between these values, therefore there is a one-to-one relationship for all possible numbers, and the equivalency is proven.

b, c. (BL2-) The largest positive integer will be 3777778, or 131071 decimal.

d. (BL2-) The largest negative number is 4000008, or -131072 decimal.

4.2 a. (BL2-) The decimal number 1987 can be converted to binary form using either of the methods shown in Chapter 2. Using the “fit” method,

1987 = 1024 + 512 + 256 + 128 + 64 + 2 + 1

= 11111000011.

As a 16-bit number, the result is 0000011111000011.

b. (BL2) The 2's complement of -1987 is found by inverting the previous result, and adding 1 to the inverted value:

1111100000111100 + 1 = 1111100000111101.

62 Part II Data in the Computer

(2)

c. (BL2-) The 4-digit hexadecimal equivalent of the answer in part (b) comes from dividing the binary value into hexadecimal parts, 4 bits at a time:

11111000001111012 = F83D16

The six-digit number will thus be FFF846. An alternative way to see this: the student can convert the positive value in part b from 4-digit hex to 6-digit hex by adding two additional 0's at the left end of the number. Since each hex 0 complements to F, the two additional F's at the left end are apparent.

4.3 a. BL3) Since the value given begins with a 3, it represents a negative number in base 4. Thus it is necessary to take the complement to find the magnitude.

The complement of 33332104 is 0000123 + 1 = 0000130. The same value can be achieved by subtracting 3333210 from 4444444.

b. (BL2+) Since both numbers are positive, the magnitudes are the same as the original values

13220231 = 13220231 00120000 = 120000

carries

111

20000231 which has a negative value due to overflow.

The sign and magnitude of 20000231 can be found by taking its complement:

20000231 = -13333102 + 1 = -133331024

4.4 (BL2+) Converting 19575 to binary yields binary value 100110001110111.

Since the binary value requires 15 bits with the left-most digit a 1, it is not possible to represent the value in less than 16 bits. If the system doesn't check for overflow (some don't!) then it will perform the 2's complement to handle the minus sign.

This gives 011001110001001 = +13193 as a final value. Note that the answer and the original value sum to 32768, which is 215. In other words, the answer has wrapped around as a result of the overflow. This is a situation one sees when the result of integer arithmetic operations exceed the integer size on systems that do not check for overflow.

4.5 (BL2)

1's complement 2's complement

a. 10000 1111111111101111 1111111111110000

b. 100111100001001 1011000011110110 1011000011110111 c. 0100111000100100 1011000111011011 1011000111011100

Chapter 4 Representing Integer Data 63

(3)

c. (BL2-) The 4-digit hexadecimal equivalent of the answer in part (b) comes from dividing the binary value into hexadecimal parts, 4 bits at a time:

11111000001111012 = F83D16

The six-digit number will thus be FFF846. An alternative way to see this: the student can convert the positive value in part b from 4-digit hex to 6-digit hex by adding two additional 0's at the left end of the number. Since each hex 0 complements to F, the two additional F's at the left end are apparent.

4.3 a. BL3) Since the value given begins with a 3, it represents a negative number in base 4. Thus it is necessary to take the complement to find the magnitude.

The complement of 33332104 is 0000123 + 1 = 0000130. The same value can be achieved by subtracting 3333210 from 4444444.

b. (BL2+) Since both numbers are positive, the magnitudes are the same as the original values

13220231 = 13220231 00120000 = 120000

carries

111

20000231 which has a negative value due to overflow.

The sign and magnitude of 20000231 can be found by taking its complement:

20000231 = -13333102 + 1 = -133331024

4.4 (BL2+) Converting 19575 to binary yields binary value 100110001110111.

Since the binary value requires 15 bits with the left-most digit a 1, it is not possible to represent the value in less than 16 bits. If the system doesn't check for overflow (some don't!) then it will perform the 2's complement to handle the minus sign.

This gives 011001110001001 = +13193 as a final value. Note that the answer and the original value sum to 32768, which is 215. In other words, the answer has wrapped around as a result of the overflow. This is a situation one sees when the result of integer arithmetic operations exceed the integer size on systems that do not check for overflow.

4.5 (BL2)

1's complement 2's complement

a. 10000 1111111111101111 1111111111110000

b. 100111100001001 1011000011110110 1011000011110111 c. 0100111000100100 1011000111011011 1011000111011100

Chapter 4 Representing Integer Data 63

(4)

4.6 a. (BL2) 24379 = 24379 5098 = 5098

29477 = 29477

b. (BL2) 24379 = 24379 -5098 = 94902

119281 = 19281

c. (BL2) -24379 = 75621 5098 = 5098

80719 = -19281

4.7 (all BL2)

a. 37968 = 37968 (-) 24109 = 975891

1013859 = 13859

b. 37968 = 37968 = 37968 (-) -70925 = (-) 929075 = 70925

108893 = 108893 c. -10255 = 989745 = 989745

(-) -7586 = (-) 992414 = 7586

997331 = -2669

4.8 (all BL2)

a

.

1250 = 1250 772950 = -227050

774200 = -225800 b. 899211 = -100789 999998 = - 2 ( 1)899209 = -100791 c. 970000 = -30000 30000 = 30000 ( 1)000000 = 000000

4.9 (all BL2)

a. 11001101101 = 1 + 4 + 8 + 32 + 64 + 512 + 1024 = 1645 111010111011 = -101000101 = - (1 + 4 + 64 + 256) = -325 (1)010100101000 = 8 + 32 + 256 + 1024 = 1320

b. 101011001100 = - 010100110100 = -1332 111111111100 = - 100 = - 4 (1)101011001000 = - 010100111000 = -1336 64 Part II Data in the Computer

(5)

point formats only near the end of the discussion, although I do try to leave enough time to explain why the leading

1

in a normalized mantissa can be omitted and what the differences are between binary and hexadecimal exponents. I use the standards included as examples for this purpose.

COMMON AREAS WHERE STUDENTS HAVE DIFFICULTIES

Students tend to have difficulty in the following areas:

wNormalization. In general, the effect on the exponent of shifting the radix point is problematical (for most of us, I suspect!). The use of decimal helps here, since students can generally recognize if a number is getting bigger or smaller in decimal.

wThe concept of excess-N notation. Why some students find this idea difficult, I cannot understand, but they do.

wThe steps that are required to perform floating point arithmetic. This issue is more practical than conceptual: remembering to line up the exponents for addition and subtraction and adjusting the exponents in multiplication and division. The solution to this problem is practice.

wConverting between floating point format and the equivalent conventional decimal or binary number representation. Again, practice makes perfect, at least for some students.

EXERCISE SOLUTIONS

5.1 a. (BL2) The exponent is 368 - 408 = - 2. Thus the number is - 6621 × 8-2 = - 66.218

b. (BL2+) In decimal, the value is -54. (2/8 + 1/64) = -54 17/64

c. (BL2-) Changing the exponent from 36 to 37 multiplies the magnitude of the value by 8.

5.2 a. (BL2+) Since the implied decimal point is at the beginning of the mantissa, the value must be represented as .19957 × 105. With an exponent stored excess-40, the represemtation is 1451996.

b. (BL2+) The range of numbers is ± 0.0001 × 10-40 to .9999 × 1059. c. (BL2-) The only change is the sign: 7451996.

d. (BL2) The six-digit 10's complementary representation of -19557 is 980443.

e. (BL2) 0.0000019557 = .19557 × 10-5. The respresentation is 1351956.

5.3 a. (BL2) 123.57 × 1015 = 1.2357 × 1017. With exponent excess-49, the result is 0661236.

68 Part II Data in the Computer

(6)

point formats only near the end of the discussion, although I do try to leave enough time to explain why the leading

1

in a normalized mantissa can be omitted and what the differences are between binary and hexadecimal exponents. I use the standards included as examples for this purpose.

COMMON AREAS WHERE STUDENTS HAVE DIFFICULTIES

Students tend to have difficulty in the following areas:

wNormalization. In general, the effect on the exponent of shifting the radix point is problematical (for most of us, I suspect!). The use of decimal helps here, since students can generally recognize if a number is getting bigger or smaller in decimal.

wThe concept of excess-N notation. Why some students find this idea difficult, I cannot understand, but they do.

wThe steps that are required to perform floating point arithmetic. This issue is more practical than conceptual: remembering to line up the exponents for addition and subtraction and adjusting the exponents in multiplication and division. The solution to this problem is practice.

wConverting between floating point format and the equivalent conventional decimal or binary number representation. Again, practice makes perfect, at least for some students.

EXERCISE SOLUTIONS

5.1 a. (BL2) The exponent is 368 - 408 = - 2. Thus the number is - 6621 × 8-2 = - 66.218

b. (BL2+) In decimal, the value is -54. (2/8 + 1/64) = -54 17/64

c. (BL2-) Changing the exponent from 36 to 37 multiplies the magnitude of the value by 8.

5.2 a. (BL2+) Since the implied decimal point is at the beginning of the mantissa, the value must be represented as .19957 × 105. With an exponent stored excess-40, the represemtation is 1451996.

b. (BL2+) The range of numbers is ± 0.0001 × 10-40 to .9999 × 1059. c. (BL2-) The only change is the sign: 7451996.

d. (BL2) The six-digit 10's complementary representation of -19557 is 980443.

e. (BL2) 0.0000019557 = .19557 × 10-5. The respresentation is 1351956.

5.3 a. (BL2) 123.57 × 1015 = 1.2357 × 1017. With exponent excess-49, the result is 0661236.

68 Part II Data in the Computer

(7)

b. (BL2+) The smallest storable number is represented by 0000001 = 0.001 × 10-49

5.4 a. (BL3) Excess-20 would be a good choice, since it is midway between 00 and 33.

b. (BL3) 16.5 = 100.24 = .1002 × 43. The representation is 0231002.

5.5 (all BL2)

a. 110110.011011 = 1.10110011011 × 25. The representation is 0 10000101 11011001101100000000000.

b. -1.1111001 is represented as 1 10000000 11111001000000000000000

c. -4F7F16 = -100111101111111 = -1.00111101111111 × 214. The representation is 1 10001110 10011110111111100000000

d. 0.00000000111111 = 1.11111 × 2-9. The representation is 0 01110111 11111100000000000000000

e. 0.1100 × 236 = 1.100 × 235. The representation is 0 10100011 11000000000000000000000

f. 0.1100 × 2-36 = 1.100 × 2-37. The representation is 0 01011011 11000000000000000000000 5.6 (all BL2+)

a. C2F0000016 = 1100001011110... . The exponent is 10000101, and the mantissa is 1.110. Shifting the number 5 places for the excess-128 exponents produces 111000.

The result in decimal is - 56.0. Alternatively, the number is -1 3/4 × 32 = - 56.0.

b. 3C54000016 = 0011110001011000... . The exponent is 01111000, and the mantissa is 1.0101. The mantissa must be shifted 8 places to the right, so the mantissa is

0.000000010101. The decimal result, in fractional form is (1/256 + 1/1024 + 1/4096)

= 21/4096.

5.7 (all BL3)

a. 171.62510 = 10101011.1012. The IEEE 754 format requires the number to be normalized as 1.0101011101 × 27. Using 8 bit excess-127 notation for the exponent, and not storing the first digit of the mantissa gives the result

0 10000110 01010111010000000000000.

Chapter 5 Floating Point Numbers 69

(8)

b. (BL2+) The smallest storable number is represented by 0000001 = 0.001 × 10-49

5.4 a. (BL3) Excess-20 would be a good choice, since it is midway between 00 and 33.

b. (BL3) 16.5 = 100.24 = .1002 × 43. The representation is 0231002.

5.5 (all BL2)

a. 110110.011011 = 1.10110011011 × 25. The representation is 0 10000101 11011001101100000000000.

b. -1.1111001 is represented as 1 10000000 11111001000000000000000

c. -4F7F16 = -100111101111111 = -1.00111101111111 × 214. The representation is 1 10001110 10011110111111100000000

d. 0.00000000111111 = 1.11111 × 2-9. The representation is 0 01110111 11111100000000000000000

e. 0.1100 × 236 = 1.100 × 235. The representation is 0 10100011 11000000000000000000000

f. 0.1100 × 2-36 = 1.100 × 2-37. The representation is 0 01011011 11000000000000000000000 5.6 (all BL2+)

a. C2F0000016 = 1100001011110... . The exponent is 10000101, and the mantissa is 1.110. Shifting the number 5 places for the excess-128 exponents produces 111000.

The result in decimal is - 56.0. Alternatively, the number is -1 3/4 × 32 = - 56.0.

b. 3C54000016 = 0011110001011000... . The exponent is 01111000, and the mantissa is 1.0101. The mantissa must be shifted 8 places to the right, so the mantissa is

0.000000010101. The decimal result, in fractional form is (1/256 + 1/1024 + 1/4096)

= 21/4096.

5.7 (all BL3)

a. 171.62510 = 10101011.1012. The IEEE 754 format requires the number to be normalized as 1.0101011101 × 27. Using 8 bit excess-127 notation for the exponent, and not storing the first digit of the mantissa gives the result

0 10000110 01010111010000000000000.

Chapter 5 Floating Point Numbers 69

(9)

b. (BL2+) The smallest storable number is represented by 0000001 = 0.001 × 10-49

5.4 a. (BL3) Excess-20 would be a good choice, since it is midway between 00 and 33.

b. (BL3) 16.5 = 100.24 = .1002 × 43. The representation is 0231002.

5.5 (all BL2)

a. 110110.011011 = 1.10110011011 × 25. The representation is 0 10000101 11011001101100000000000.

b. -1.1111001 is represented as 1 10000000 11111001000000000000000

c. -4F7F16 = -100111101111111 = -1.00111101111111 × 214. The representation is 1 10001110 10011110111111100000000

d. 0.00000000111111 = 1.11111 × 2-9. The representation is 0 01110111 11111100000000000000000

e. 0.1100 × 236 = 1.100 × 235. The representation is 0 10100011 11000000000000000000000

f. 0.1100 × 2-36 = 1.100 × 2-37. The representation is 0 01011011 11000000000000000000000 5.6 (all BL2+)

a. C2F0000016 = 1100001011110... . The exponent is 10000101, and the mantissa is 1.110. Shifting the number 5 places for the excess-128 exponents produces 111000.

The result in decimal is - 56.0. Alternatively, the number is -1 3/4 × 32 = - 56.0.

b. 3C54000016 = 0011110001011000... . The exponent is 01111000, and the mantissa is 1.0101. The mantissa must be shifted 8 places to the right, so the mantissa is

0.000000010101. The decimal result, in fractional form is (1/256 + 1/1024 + 1/4096)

= 21/4096.

5.7 (all BL3)

a. 171.62510 = 10101011.1012. The IEEE 754 format requires the number to be normalized as 1.0101011101 × 27. Using 8 bit excess-127 notation for the exponent, and not storing the first digit of the mantissa gives the result

0 10000110 01010111010000000000000.

Chapter 5 Floating Point Numbers 69

(10)

The number 343.250 is double 171.625. Therefore, the exponent increases by 1, giving

0 10000110 01010111010000000000000.

The number 1716.25 is 10 × 171.625, which doesn't simplify the solution (which is the point, of course). 1716.25 = 11010110100.01 = 1.101011010001 × 210. This gives the result

0 10001001 10101101000100000000000.

b. IBM short format requires a base-16 exponent, with the implied point at the beginning of the mantissa. Therefore the number 171.625 is represented as .010101011101 × 28, where 28 = 162.

The mantissa is stored using excess-64 notation, so the result is 0 1000010 010101011101000000000000.

The number 343.250 shifts the mantissa, but not the exponent, since the exponent only shifts for changes of 16X or more. Therefore, the result is now

0 1000010 101010111010000000000000.

From (a), the number 1716.25 = 1.101011010001 × 210 = 0.01101011010001 × 212. 212 = 163. Therfore, the result is 0 1000011 011010110100010000000000.

c. Alpha D format uses an 8 bit excess-128 exponent and a 55-bit mantissa. The implied binary point is to the left of the normalized mantissa, and the left-most 1 is not stored. The binary value, from (a) is 10101011.101

= 0.10101011101 × 28. This gives the result 0 10001000 0101011101 + 45 zeros.

Doubling the number increases the exponent by 1, to 10001001, without affecting the remainder of the result.

From (a), the value 1716.25 = 11010110100.01 = 0.1101011010001 × 211. The result is

0 10001011 101011010001 + 43 zeros.

5.8 (BL1+) -129975 is represented as 0000 0001 0010 1001 1001 0111 0101 1101 5.9 (all BL2+)

a. To add the numbers, the exponents must agree.

70 Part II Data in the Computer

Références

Documents relatifs

The proposed representation format corresponds to a simple and efficient implementation of significance arithmetic based and compatible with the IEEE Standard 754

Using a simplified model of the sound field generated inside the test sample by a wall turbulent pressure field inside a cylindrical hole, it is easy to determine,

Wenn wir nun als bekenntnisunabhängigen Religionsunterricht einen Unterricht begreifen, der die Schülerinnen und Schüler zu keinerlei aktiver Partizipation an

Les dermatoses virales communes chez

These graphs can be used to quickly compute a very rough estimation of the area and latency of a given circuit according to the dynamic, the precision and the number

Plus tard, lorsque Thersite, finalement plus terrassé par la honte que par la peur d’Achille, révèle sous la pression du héros qu’il est l’homme qui a promis à Téléia de

[r]