Vous êtes sur la page 1sur 7

1

Computer Number Systems and Floating


Point Arithmetic
1. Find the binary representation of the following decimal numbers.
(a) e (2.718)10
(b)

7
8

(c) (792)10
2. Convert the following decimal numbers to octal numbers.
(a) 37.1
(b) 12.34
(c) 3.14
(d) 23.38
(e) 75.231
(f) 57.231
3. Convert the following binary numbers to octals and then to decimal
numbers.
(a) (110 111 001.101 011 101)2
(b) (1 001 100 101.011 01)2
4. Convert the following numbers as required.
(a) (100 101 101)2 = (
(b) (0.782)10 = (
(c) (47)10 = (
(d) (0.47)10 = (
(e) (51)10 = (
(f) (0.694)10 = (

)8 = (

)8 = (
)8 = (

)2
)2

)8 = (
)8 = (

)2
)2

)8 = (

)2

(g) (110 011.111 010 110 110 1)2 = (


(h) (351.4)8 = (

)10

)2 = (

)10
1

)8 = (

)10

(i) (45753.127664)8 = (

)2 = (

)10

5. Convert x = (0.6)10 first to octal and then to binary. Check your result
by converting directly to binary.
6. Prove that the decimal number
the binary system.

1
7

does not have a finite expansion in

7. Prove or disprove - by giving a counter example - the following statements:


(a) Any real number that has a finite representation in the binary
number system is of the form m/2n , where n and m are positive
integers.
(b) Any real number of the form m/2n has a finite representation in
the binary number system
(c) Any number that has a finite representation in the binary system
must have a finite representation in the decimal system.
(d) Any number that has a finite representation in the decimal system
must have a finite representation in the binary system.
(e) A number has a finite representation in the octal system if and
only if it has a finite representation in the binary system.
8. Display the positive elements of the floating point system F (2, 3, 2, +3).
Determine the cardinality of |F .
9. Determine the IEEE single precision representation of the decimal number 64.015625.
10. Determine the IEEE single and double precision representations of the
following decimal numbers:
(a) 0.5, 0.5
(b) 0.125, 0.125
(c) 0.03125, 0.03125
(d) 1.0, 1.0
(e) +0.0, 0.0
2

(f) 987.0054321
(g) 385.65
(h) 102
11. Identify the decimal floating point numbers corresponding to the following bit strings in the IEEE single precision system:
(a) 0 00000000 00000000000000000000000
(b) 1 00000000 00000000000000000000000
(c) 0 11111111 11111111111111111111111
(d) 1 11111111 11111111111111111111111
(e) 0 00000001 00000000000000000000000
(f) 0 10000001 11110000000000000000000
(g) 0 01111111 00000000000000000000000
(h) 0 01111011 11111001100110011001101
12. In the IEEE single precision system, what are the bit-string representation for the following sub-normal numbers?
(a) 2128 + 2139
(b) 2132 + 2145
(c) 2129 + 2130
P149
k
(d)
k=127 2
13. Determine the decimal numbers that have the following IEEE single
precision system representations:
(a) [3F 27E520]16
(b) [CA3F 2900]16
(c) [C705A700]16
(d) [494F 96A0]16
(e) [4B187ABC]16
(f) [45223000]16
(g) [45607000]16
3

(h) [C553E100]16
(i) [437F 0001]16
14. Convert the greatest positive element in single precision to an octal
number o and write it in normalized floating point notation. Convert then the resulting o to a decimal number d and write it in
normalized floating point notation.
15. (a) Identify the binary number x whose 32 bit-string representation
in single precision is as follows:
1 00000001 00000000000000000000000
(b) Find the next largest and smallest machine numbers in single precision for the number x given above, then write their hexadecimal
representation.
16. Consider the binary number b = 1.01 2+128 .
(a) Write the machine number representing b in IEEE double precision, then write its corresponding hexadecimal representation.
(b) Write the machine number representing b in IEEE single precision,
then write its corresponding hexadecimal representation.
(c) Let xM be the midpoint of the interval [0, b]. Write the machine
number representing xM in IEEE single precision, then write its
hexadecimal representation.
17. Consider the binary number b = 2127 + 2130 .
(a) Write the machine number representing b in IEEE single precision,
then write its corresponding Hexadecimal representation.
(b) Find the successor of b (y = succ(b)) in IEEE single precision,
then write its corresponding machine number and Hexadecimal
representation.
(c) Write the machine number representing b in IEEE double precision, then write its corresponding hexadecimal representation.
(d) Find the predecessor of b (x = pre(b)) in IEEE double precision,
then write its corresponding machine number and hexadecimal
representation.
4

18. For some values of x, the following functions cannot be accurately computed by using the given formula. Explain and find a way around the
difficulty.

(a) f (x) = x2 + 1 x

(b) f (x) = x4 + 4 2

(c) f (x) = x + 2 x

(d) f (x) = ( x + 4)1/2 ( x)1/2


19. For some values of x, the following functions cannot be accurately computed by using the given formula. Explain and find a way around the
difficulty.
(a) f (x) = 1 sin x
(b) f (x) = 1 cos x
(c) f (x) = 2 cos2 x 1
(d) f (x) = (cos x ex )/ sin x
(e) f (x) = ex sin x cos x
20. For some values of x, the following functions cannot be accurately computed by using the given formula. Explain and find a way around the
difficulty.
(a) f (x) = tanh x =
(b) f (x) =

1
(sinh x
x3

ex ex
ex +ex

tanh x)

21. For some values of x, the following functions cannot be accurately computed by using the given formula. Explain and find a way around the
difficulty.
(a) f (x) = ln(x) 1
(b) f (x) = ln x ln (1/x)
(c) f (x) = x2 (sin x ex + 1)
(d) f (x) = ex e

22. Let f (x) = ln(x + x2 + 1). Show how to avoid loss of significance in
computing f (x) when x is negative. Hint: Compute first f (x).
5

23. For some values of x, the function f (x) = x +


accurately computed by using the given formula.

x2 1 cannot be

(a) What values of x are involved? What remedy do you propose?


(b) Carry 3 decimal significant figures, for example in F (10, 3, 24, +25)
with rounding to the closest, and compute f (102 ) directly, then
using the suggested remedy. (The exact value of f (102 ) is 0.005000125006250).
24. Let f (x) =

(ex 1)sin x
x2

(a) For some values of x the function f (x) cannot be accurately computed by using the given formula. What are the non-negative
values of x that cause the problem? What remedy do you propose?
(b) Use the first 2 terms only of the Taylors series derived in (a), to
approximate f (104 ) in F (10, 5, 15, +15), rounding to the closest.
(c) Find the absolute relative error in this approximation if the exact
value of f (104 ) is 0.50003333807.....
25. Let
f (x) =

ex ex
x

(a) For which value of x, the given function cannot be accurately


computed. Explain and find a way around the difficulty.
(b) Carry 3 significant digits with rounding to the closest to evaluate
f (0.1) directly.
(c) Repeat part (b) using the suggested remedy.
(d) The actual value is f (0.1) = 2.003335000. Find the relative error
for the values obtained in parts (b) and (c).
26. Use the Taylor polynomial of degree 4 to find an approximation to
e3 by each of the following methods, carrying 3 significant digits with
rounding to the closest:
P
i 3i
(a) e3 = 5i=0 (1)
i!
6

(b) e3 =

1
e3

1
3i
i=0 i!

P5

(c) An approximate value of e3 is 6.74 103 . Compare this value


with the results obtained in (a) and (b). Explain your answer.

Vous aimerez peut-être aussi