Math1003 1.16 - Real Numbers

  • View
    154

  • Download
    0

Embed Size (px)

Text of Math1003 1.16 - Real Numbers

  • 1. 1.1610110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers MATH1003

2. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001 Goal To be able to represent real numbers in IEEE standard form. MATH1003 3. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers MATH1003 4. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers MATH100335.0 5. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersReal Numbers are stored by a totally different method from integers. MATH100335.0 6. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersReal Numbers are stored by a totally different method from integers.Although many schemes are possible, we will explore a scheme that is widely used and accepted by the IEEE(Institute for Electrical and Electronic Engineering). MATH100335.0 7. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers MATH100335.0 8. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers Real numbers are stored as32 bits (usually referred to as the type oat) or64 bits (usually referred to as the type double). MATH100335.0 9. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers Real numbers are stored as32 bits (usually referred to as the type oat) or64 bits (usually referred to as the type double).For our discussions, well use 32 bits35.0to represent a real number. MATH1003 10. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers The 32 bits are divided into 3 sections. MATH100335.0 11. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers The 32 bits are divided into 3 sections. MATH100335.0 12. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberssign bit The 32 bits are divided into 3 sections. MATH100335.0 13. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberssigne xponent bit 8 bits The 32 bits are divided into 3 sections. MATH100335.0 14. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberssigne xponent number bit 8 bits23 bits The 32 bits are divided into 3 sections. MATH100335.0 15. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberssigne xponent number bit 8 bits23 bits The 32 bits are divided into 3 sections.This is the 1-8-23 pattern. MATH100335.0 16. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberssign bitsign bit : 0 for a positive number, 1 for negative The 32 bits are divided into 3 sections.This is the 1-8-23 pattern. MATH100335.0 17. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers MATH1003 18. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form MATH1003 19. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number MATH1003 20. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form MATH1003 21. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit MATH1003 22. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary) MATH1003 23. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 24. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 25. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersRepresent 25.010 in IEEE standardSteps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 26. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersRepresent 25.010 in IEEE standard1. 25.010 = 11001.02Steps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 27. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersRepresent 25.010 in IEEE standard1. 25.010 = 11001.022. normalize 11001.02Steps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 28. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersRepresent 25.010 in IEEE standard1. 25.010 = 11001.022. normalize 11001.021.1001 x 2 4Steps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 29. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numbers this is similar toscientic notation except that we useRepresent 25.010 in IEEE standard powers of 21. 25.010 = 11001.022. normalize 11001.021.1001 x 2 4Steps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 30. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real Numberswe moved thepoint 4 positions tothe left, so ourRepresent 25.010 in IEEEstandardexponent is 41. 25.010 = 11001.022. normalize 11001.021.1001 x 2 4Steps to represent a number in IEEE standard form1. calculate the binary form of the number2. calculate the normalized binary form3. set the sign bit4. store the exponent (+127, store as an 8-bit binary)5. store the normalized binary form without the rst 1 MATH1003 31. 10110100101011010100101010111010101111011011101111011101110111101110111011110111111010110100101011110110110101111011010100111111011010100110101001Real NumbersRepresent 25.010 in IEEE standard1. 25.010 = 11001.022. normalize 11001.021.1001 x 2 43. set the sign bitSteps to represent a number in