1 / 25

Factional Values

Factional Values. What is 0.75 in binary?. How could we represent fractions?. In decimal: As fractions : 1/5 . How could we represent fractions?. In decimal: As fractions : 1/5 As decimals : 0.2. Column Pattern. What goes to the right of 1’s column?. Column Pattern.

makara
Download Presentation

Factional Values

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. Factional Values What is 0.75 in binary?

  2. How could we represent fractions? • In decimal: • As fractions : 1/5

  3. How could we represent fractions? • In decimal: • As fractions : 1/5 • As decimals : 0.2

  4. Column Pattern • What goes to the right of 1’s column?

  5. Column Pattern • Negative powers of two: 2-3 = = = 0.125

  6. Number • Binary decimal: 10.112 = 2 + 0.5 + 0.25 = 2.7510

  7. Number • Binary decimal: 0.10012 = 0.5 + 0.0625 = 0.562510

  8. Number • Binary decimal: 0.10102 = 0.5 + 0.125 = 0.62510

  9. Missing Numbers • Where is 0.6? 0.10012 = 0.5 + 0.0625 = 0.562510 0.10102 = 0.5 + 0.125 = 0.62510

  10. More Digits • An attempt with 11 decimal digits:

  11. More Digits • With fixed decimal, adding digits… • To left of decimal: Bigger values • To right of decimal:More accurate values

  12. Decimals are an Approximation • Regardless, some values will be hard • Decimal has same issue: • What is 1/3 ?? What is 2/7 ??

  13. Fixed Decimal Problems • Fixed decimal points waste space: 100,000,000,000,000,000 vs 1017 0.000000000000025 vs 2.5 x 10-14

  14. Fixed Decimal Problems • Fixed decimal points waste space: 100,000,000,000,000,000 vs 1017 0.000000000000025 vs 2.5 x 10-14 • In computers, space is precious • Computers use a floating decimal point(Like scientific notation)

  15. Floating Point • Bits used to represent 3 parts: • Sign • Exponent • Fraction (or Mantissa)

  16. Sign • 0 = positive, 1 = negative

  17. Exponent • Binary integer in excess notation • Gives power of 2 to multiply by 100 = 0 So 20

  18. Mantissa • Fractional Value • Always a decimal 1000 = 0.5

  19. Examples + 20 x 0.5 = + 1 x 0.5 =+ 0.5

  20. Examples - 23 x 0.5625 = - 8 x 0.5625 = -4.5

  21. Examples + 2-4 x 0.25 = + 0.0625 x 0.25 = +0.015625

  22. Floating Point Math is HARD • XOR the signs • Calculate new exponent • Excess Notation – different math rules! • Calculate new mantissa • Normal binary multiplication

  23. Choices, choices • Choices • More bits to exponent • More bits to mantissa • How we represent each • What is our excess start point? • Do mantissas have to start with 1?

  24. 32 Bit Floating Point • PC processors are 32 or 64 bit • Size of data they can work on at one time • IEEE specifies conventions for floating points:

  25. Remember… • Decimals are approximate • 32 bit float gives 6-7 significant decimal digits • 64 bit float gives 15-16 significant decimal digits

More Related