Presentation is loading. Please wait.

Presentation is loading. Please wait.

Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man.

Similar presentations


Presentation on theme: "Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man."— Presentation transcript:

1 Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man

2 Floating-point number representation E.g.110.011 (2) can be written as 11.0011 x 2 1 or 1.10011 x 2 2 or 0.11011 x 2 3 (Normalized form)

3 Format The basic format is shown as follow: Sign bit Exponent Mantissa Sign bitExponentMantissa

4 Note… Excess 128 method That is, add 128 to the current value.

5 Eg 1 Assume 16-bit word and EXCESS 128 method is used: 13.125 = 1011.001 (ii) = 0.1011001 x 2 4 Fraction= 0.1011001 Exponent= 4 x 128 = 132 = 10000100 (ii) Since the number is positive, therefore the sign bit is 0. Therefore 13.125 will be stored as 0100001001011001

6 E.g.2 -29.75= -11101.11 (ii) = -0.1110111 x 2 5 (normalization) Fraction= 0.1110111 Fraction= 5 + 128 = 133 = 10000101 (ii) Since the number is negative, therefore the sign bit is 1. Therefore –29.75 will be stored as 1100001011110111

7 E.g.3 -0.0625= -0.0001 (ii) = -0.1 x 2 -3 (normalization) Fraction= 0.1000000 Exponent= -3 + 128 = 125 = 01111101 (ii) Since the number is negative, therefore the sign bit is1. Therefore –0.0625 will be stored as 1011111011000000

8 Comparison between fixed-point representation and floating point representation Range Fixed-point numbers Largest positive number = 01111111 11111111 = +32767 Smallest negative number= 10000000 0000000= -32768 Therefore, in 16-bit word storage: -32768 <= fixed point number <= +32767

9 Floating-point representation AAssume excess-128 method and 16-bit word is used, a dloating point representation cab have the following values: Largest positive number= 0 111111111111111  2 +127  10 +38 Smallest positive number= 0 000000001000000  2 -128  10 -39

10 More… Largest negative number= 1 00000001000000  2 -128  -10 -39 Smallest negative number= 1 111111111111111  -2 +127  -10 +38

11 More…thus… Therefore, the range of floating number: -2 127  -2 -128, 0, 2 -128  2 127 From the above, we can see that the range of the floating-point representation is wider than that of fixed-point representation.


Download ppt "Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man."

Similar presentations


Ads by Google