Year 1         LESSON 3       FLOTING POINT      REPRESENTATION♦   A better alternative to fixed-point    representation i...
Year 1FLOTING POINT NOTATION♦   Scientific Notation (Decimal)                               4     •   57429 = 5.7429 x 10 ...
Year 1NORMALISED FLOATINGPOINT FORM (DECIMAL)♦   Divide mantissa by 10, increase    exponent by 1♦   Mantissa now always f...
Year 1NORMALISED FLOATING POINT FORM (BINARY)♦   Same principles as decimal♦   Mantissa always fraction 0.1    (binary) or...
Year 1          FLOTING POINT           ARITHMETIC♦   Also called “Real” Arithmetic♦   In most practical cases, computer  ...
Year 1          FLOTING POINT            ADDING (1)♦   Two possibilities:     •   Exponents are the same     •   Exponents...
Year 1         FLOTING POINT           ADDING (2)♦   Different exponents                    3                5    ( 0.1001...
Year 1          FLOTING POINT          SUBTRACTION♦   Similar to addition                            7                 7  ...
Year 1            FLOTING POINT            MULTIPLICATION♦   Multiply the mantissa and add the    exponents               ...
Year 1FLOTING POINT DIVISION♦   Divide the mantissa and subtract    the exponents                      8                  ...
Year 1          FLOTING POINT           STORAGE(1)                          E               mxB            where♦   Mantis...
Year 1      STORING NEGATIVE         MANTISSA♦   Sign Bit     ‘0’ is assigned if the mantissa is     positive     ‘1’ is a...
Year 1      STORING NEGATIVE         MANTISSA♦   Two’s complement form     •   The exponent is stored in its two’s        ...
Year 1STORE FLOATING POINT      FORMAT♦   Format A     Sign modulus mantissa & 2’s     complement exponent     •   Floatin...
Year 1STORE FLOATING POINT      FORMAT♦   Format C     •   Sign modulus mantissa & excess         2 n-1 method     The fir...
Upcoming SlideShare
Loading in …5
×

MELJUN CORTES - Number System

658 views

Published on

MELJUN CORTES - Number System

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
658
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
19
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

MELJUN CORTES - Number System

  1. 1. Year 1 LESSON 3 FLOTING POINT REPRESENTATION♦ A better alternative to fixed-point representation is the floating- point representation♦ Capable of holding, in a single- length word, a greater range of numbers.♦ It also uses the same form for coping with integers, mixed numbers or fractions but at a cost of reduced accuracy.♦ The floating-point form is suitable CS113/0401/v1 quantities of far 3 - 1 for handling Lesson higher value than usual, or whose
  2. 2. Year 1FLOTING POINT NOTATION♦ Scientific Notation (Decimal) 4 • 57429 = 5.7429 x 10 Mantissa Exponent♦ Mantissa always 1 or greater, but less than 10 1 < m < 10♦ Exponent always integer♦ N.B:Mantissa can also be negative CS113/0401/v1 Lesson 3 - 2
  3. 3. Year 1NORMALISED FLOATINGPOINT FORM (DECIMAL)♦ Divide mantissa by 10, increase exponent by 1♦ Mantissa now always fraction, 0.1 or bigger 0.1 < M < 1♦ Example : 8 • 0.93 x 10 -28 • 0.9 x 10-2♦ Normalisation gets rid of mixed numbers • Better for computers CS113/0401/v1 Lesson 3 - 3
  4. 4. Year 1NORMALISED FLOATING POINT FORM (BINARY)♦ Same principles as decimal♦ Mantissa always fraction 0.1 (binary) or bigger 0.1 < M < 1♦ Exponent is positive or negative integer♦ N.B: Mantissa needs a sign bit, but doesn’t use two’s complement CS113/0401/v1 Lesson 3 - 4
  5. 5. Year 1 FLOTING POINT ARITHMETIC♦ Also called “Real” Arithmetic♦ In most practical cases, computer calculations are done in real arithmetic♦ Real is a word with a special mathematical meaning CS113/0401/v1 Lesson 3 - 5
  6. 6. Year 1 FLOTING POINT ADDING (1)♦ Two possibilities: • Exponents are the same • Exponents are different♦ Need different methods♦ Same exponents♦ Add mantissas 5 5 (0.1011 x 2 ) + (0.1001 x 2 ) 5 = 1.0100 x 2♦ For Normalised floating point, mantissa is too big therefore must normalise 6 = 0.1010 x 2 Could lose accuracy here 3 - 6 CS113/0401/v1 Lesson
  7. 7. Year 1 FLOTING POINT ADDING (2)♦ Different exponents 3 5 ( 0.1001 x 2 ) + ( 0.1110 x 25 )♦ Increase smaller exponent and adjust mantissa 5 5 ( 0.001001 x 2 ) + ( 0.1110 x 25 )♦ Add as before 5 = 1.00000 x 2 ROUNDED ( lost accuracy )♦ Normalise and truncate 6 = 0.10000 X 2 Could lose accuracy here CS113/0401/v1 Lesson 3 - 7
  8. 8. Year 1 FLOTING POINT SUBTRACTION♦ Similar to addition 7 7 ( 0.1110 x 2 ) - ( 0.1100 x 2 ) 7 =0.0010 x 2 5 =0.1000 x 2 ( Normalised ) introduced inaccuracy 8 5 ( 0.1001 x 2 ) - ( 0.1000 x 2 ) 8 8 =( 0.1001 x 2 ) - ( 0.0001000 x 2 ) accuracy lost 8 =0.1000 x 2 CS113/0401/v1 Lesson 3 - 8
  9. 9. Year 1 FLOTING POINT MULTIPLICATION♦ Multiply the mantissa and add the exponents 6 4 ( 0.1101 + 2 ) x ( 0.1010 x 2 ) 10 = (0.01101 x 0.0001101 ) x 2 10 = 0.1000001 x 2 10 = 0.1000 x 2 truncated 7 -11 ( 0.1001 x 2 ) x ( 0.1111 x 2 ) -4 = 0.10000111 x 2 -4 = 0.1000 x 2 truncated CS113/0401/v1 Lesson 3 - 9
  10. 10. Year 1FLOTING POINT DIVISION♦ Divide the mantissa and subtract the exponents 8 -4 ( 0.111 X 2 ) ÷ ( 0.1000 X 2 ) 12 = 1.111 X 2 13 = 0.1111 X 2 ( Normalised ) 7 4 ( 0.1011 x 2 ) ÷ ( 0.1101 x 2 ) 3 = 0.1101 x 2 CS113/0401/v1 Lesson 3 - 10
  11. 11. Year 1 FLOTING POINT STORAGE(1) E mxB where♦ Mantissa can be in • Sign modulus • 2’s complement♦ Exponent can be in • 2’s complement n-1 • Excess 2 where n is the no. of storage bits for exponent CS113/0401/v1 Lesson 3 - 11
  12. 12. Year 1 STORING NEGATIVE MANTISSA♦ Sign Bit ‘0’ is assigned if the mantissa is positive ‘1’ is assigned if the mantissa is negative♦ Two’s Complement Method • The two’s complement of the mantissa is used if it is negative. CS113/0401/v1 Lesson 3 - 12
  13. 13. Year 1 STORING NEGATIVE MANTISSA♦ Two’s complement form • The exponent is stored in its two’s complement form if it is negative and so we do not need to allocate a separate space to hold the sign of the exponent. Although we must always do so for that of the mantissa. n-1♦ Excess 2 (where n is the number of bits assigned for the exponent) n-1 • In this method, the value of 2 is added to the actual exponent whether positive or negative to give the stored exponent. n-1 Stored Exponent = True Exponent + 2 OR n-1 True Exponent = Store Exponent -2 CS113/0401/v1 Lesson 3 - 13
  14. 14. Year 1STORE FLOATING POINT FORMAT♦ Format A Sign modulus mantissa & 2’s complement exponent • Floating point numbers are stored using 6 bits. The first bit is the mantissa sign bit, next 9 are the normalised mantissa and the final six bits are the exponent in 2’s complement.♦ Format B 2’s complement’s mantissa & 2’s complement exponent • Floating point numbers are stored using 16 bits. The ten bit 2’s complement mantissa followed by a six-bit 2’s complement exponent CS113/0401/v1 Lesson 3 - 14
  15. 15. Year 1STORE FLOATING POINT FORMAT♦ Format C • Sign modulus mantissa & excess 2 n-1 method The first bit is the mantissa sign bit, the next 9 bits are normalised mantissa, the final six bits the n-1 exponent in excess 2 form.♦ Format D n-1 2’s complement’s mantissa & 2 method • Given 16 bits storage. First 10 bits 2’s complement mantissa followed by 6 bits exponent in n-1 excess 2 form. CS113/0401/v1 Lesson 3 - 15

×