• date post

16-May-2015
• Category

## Education

• view

5.589

6

Embed Size (px)

description

Representation of Real Numbers

### Transcript of Representation of Real Numbers

• 1.

2. What are Real Numbers? Real Numbers include:

• Whole Numbers (like 1,2,3,4, etc)
• Rational Numbers (like 3/4, 0.125, 0.333..., 1.1, etc )
• Irrational Numbers (like , 3, etc )
• Real Numbers can also be positive, negative or zero

15 3148 -27 2/7 99/100 14.75 0.000123 100.159 3 340.1155 22.9 In Computing, real numbers are also known asfloating point numbers 3. Standard Form Standard form is a scientific notation of representing numbers as abasenumber and anexponent . Using this notation: The decimal number8674.26can be represented as 8.67426 x 10 3 , withmantissa =8.67426 , base =10and exponent =3 The decimal number753.34can be represented as 7.5334 x 10 2 ,withmantissa = 7.5334 , base =10and exponent =2 The decimal number0.000634can be represented as 6.34 x 10 -3 ,with mantissa=6.34 , base =10and exponent =-3 Any number can be represented in any number base in the formm x b e 4. Floating Point Notation In floating point notation, the real number is stored as 2 separate bits of data A storage location called themantissaholds the complete number without the point. A storage location called theexponentholds the number of places that the point must be moved in the original number to place it at the left hand side. 5. Floating Point Notation What is the exponent of10110.110 ? Theexponent is 5 , becausethe decimal point has to be moved 5 places to get it to the left hand side. The exponent would be represented as0101in binary 6. Floating Point Notation How would10110.110be stored using 8 bits for the mantissa and 4 bits for the exponent? We have already calculated that theexponent is 5or0101 . 10110.110=10110110x2 5 =10110110x2 0101 It is not necessary to store the x sign or the base because it is always 2. Mantissa Exponent 7. Floating Point Notation How would24.5be storedusing8 bits for the mantissa and 4 bits for the exponent?In binary, the numbers after the decimal point have the following place values: 1/21/41/81/161/321/641/128 24has the binary value11000 0.5(or1/2 ) has the binary value.1 24.5 = 0011000.1 8. Floating Point Notation How would0011000.1be stored using 8 bits for the mantissa and 4 bits for the exponent? 9. Floating Point Notation How would0011000.1be stored using 8 bits for the mantissa and 4 bits for the exponent? The exponent is 7 because decimal point has to move 7 places to the left 0011000.1=00110001x2 7 =00110001x2 0111 Mantissa Exponent 10. Accuracy Store110.0011001in floating point representation, using 8 bits for the mantissa and 4 bits for the exponent. Mantissa Exponent The mantissa only holds 8 bits and so cannot store the last two bits These two bits cannot be stored in the system, and so they are forgotten. The number stored in the system is110.00110which is less accurate that its initial value. 11. Accuracy If the size of themantissa is increasedthen theaccuracyof the number held isincreased . Mantissa (10 bits) Exponent 12. Range If increasing the size of the mantissa increases the accuracy of the number held,what will be the effect of increasing the size of the exponent? Using two bits for the exponent, the exponent can have the value0-3 Mantissa Exponent (2 bits) This means the number stored can be in the range .00000000 (0)to 111.11111 (7.96875) 13. Range Increasing the exponent to three bits, it can now store the values0-7 Mantissa Exponent (3 bits) This means the number stored can be in the range .00000000 (0)to 1111111.1 (127.5) If the size of theexponent is increasedthen therangeof the number s which can be stored isincreased . 14. Credits

• Higher Computing Data Representation Representation of Real Numbers
• Produced by P. Greene and adapted by R. G. Simpson for the City of Edinburgh Council 2004
• Adapted by M. Cunningham 2010
• All images licenced under Creative Commons 3.0
• Happy Pi Day by Mykl Roventine