1 / 9

ECT 358

ECT 358. Lecture 16 Floating Point. Whoever gossips to you will be a gossip of you. A gossip betrays a confidence,        but a trustworthy man keeps a secret. Proverbs 11:13. Fixed and Floating Point. Fixed Point Unsigned Signed Floating Point. 1101 (13) 10 Multiplicand M

byrd
Télécharger la présentation

ECT 358

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. ECT 358 Lecture 16 Floating Point

  2. Whoever gossips to you will be a gossip of you. A gossip betrays a confidence,        but a trustworthy man keeps a secret. Proverbs 11:13

  3. Fixed and Floating Point • Fixed Point • Unsigned • Signed • Floating Point

  4. 1101 (13)10 Multiplicand M 1011 (11)10 Multiplier Q 1101 1101 Partial Products 0000 1101 10001111 (143)10 Product Binary Multiplication • Similar to algorithm used to multiply by hand • Multiplying two n-bit numbers can result in a 2n-bit product

  5. Binary Multiplication B[1] B[0] A[1] A[0] A[0]B[1] A[0]B[0] A[1]B[1] A[1]B[0] _____________________________ S[3] S[2] S[1] S[0] NOTE: S[0] = A[0]&&B[0] S[1] = A[0]&&B[1]^ A[1]&&B[0] S[2] = A[1]&&B[1]^A[0]&&B[1]&& A[1]&&B[0] S[3] = A[1]&&B[1]&&A[0]&&B[1]&& A[1]&&B[0]

  6. Floating Point Numbers • IEEE Format • Single precision • The sign is for the fraction • Exponent uses excess 127 so all exponents are positive Exponent (8 bits) Fraction (23 bits) Sign (1 bits)

  7. S Exponent Fraction 0 0 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 3 E A A A A A B Floating Point Numbers Example • Convert from decimal to floating point in hex • Convert decimal into binary fixed point • .333333 = .010101010101010101… • Normalize (shift until in the form of 1.nnnn) • Shift 2 places left • 1.010101010101010… x2-2 • Remove the leading 1 • .01010101010101… x2-2 • Fraction is 01010101010101… • Exponent is -2 + 127 = 12510 and in binary 0111 11012 • Sign is 0 (positive fraction)

  8. Floating Point Numbers Example • Convert from Hex floating point to Decimal • Convert Hex into binary fixed point • 4234800016 = 0100 0010 0011 0100 1000 0000 0000 0000 • Exponent = 132 – 127 = 5 • Fraction = .01101001000000 • Return the leading 1 • Fraction = 1.011010010000000 • Locate binary point (shift right 5 places) • Fixed point Binary 0010 1101 . 0010 0000 • Convert from fixed point binary to decimal • Decimal = 45.125 Exponent Fraction

  9. Floating Point Numbers Examples • Convert 1.3333333 to Hex floating point • Answer 3FAA AAAB • Convert 17.0 to Hex floating point • Answer 4188 0000 • Convert 4234 8000 to Decimal floating point • Answer 45.125 • Convert 42E4 8000 to Decimal floating point • Answer 114.25

More Related