1 / 11

Representation of Data (Part II)

Representation of Data (Part II). Computer Studies Notes: chapter 19 Ma King Man. 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). Sign bit. Exponent. Mantissa. Format.

Télécharger la présentation

Representation of Data (Part II)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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 21 or 1.10011 x 22 or 0.11011 x 23 (Normalized form)

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

  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 24 • 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 • 0 10000100 1011001

  6. E.g.2 • -29.75 = -11101.11(ii) • = -0.1110111 x 25 (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 • 1 10000101 1110111

  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 • 1 01111101 1000000

  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 • 11111111 1111111 •  2+127 10+38 • Smallest positive number = 0 • 00000000 1000000 •  2-128 10-39

  10. More… • Largest negative number = 1 0000000 1000000 •  2-128 -10-39 • Smallest negative number = 1 11111111 1111111 •  -2+127 -10+38

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

More Related