Floating Point Representation Major All Engineering Majors Authors

  • Slides: 21
Download presentation
Floating Point Representation Major: All Engineering Majors • Authors: Autar Kaw, Charlie Barker Presented

Floating Point Representation Major: All Engineering Majors • Authors: Autar Kaw, Charlie Barker Presented by: ﺩکﺘﺮ ﺍﺑﻮﺍﻟﻔﻀﻞ ﺭﻧﺠﺒﺮ ﻧﻮﻋی http: //numericalmethods. eng. usf. edu Transforming Numerical Methods Education for STEM Undergraduates 27/11/2020 http: //numericalmethods. eng. usf. edu 1

Floating Point Representation http: //numericalmethods. eng. usf. edu 27/11/2020 http: //numericalmethods. eng. usf. e

Floating Point Representation http: //numericalmethods. eng. usf. edu 27/11/2020 http: //numericalmethods. eng. usf. e du 2

Floating Decimal Point : Scientific Form 27/11/2020 3 http: //numericalmethods. eng. usf. edu

Floating Decimal Point : Scientific Form 27/11/2020 3 http: //numericalmethods. eng. usf. edu

Example The form is or Example: For 27/11/2020 4 http: //numericalmethods. eng. usf. edu

Example The form is or Example: For 27/11/2020 4 http: //numericalmethods. eng. usf. edu

Floating Point Format for Binary Numbers 1 is not stored as it is always

Floating Point Format for Binary Numbers 1 is not stored as it is always given to be 1. 27/11/2020 5 http: //numericalmethods. eng. usf. edu

Example 9 bit-hypothetical word §the first bit is used for the sign of the

Example 9 bit-hypothetical word §the first bit is used for the sign of the number, §the second bit for the sign of the exponent, §the next four bits for the mantissa, and §the next three bits for the exponent We have the representation as 0 Sign of the number 0 1 Sign of the exponent 0 1 mantissa 1 1 0 1 exponent 27/11/2020 6 http: //numericalmethods. eng. usf. edu

Machine Epsilon Defined as the measure of accuracy and found by difference between 1

Machine Epsilon Defined as the measure of accuracy and found by difference between 1 and the next number that can be represented 27/11/2020 7 http: //numericalmethods. eng. usf. edu

Example Ten bit word §Sign of number §Sign of exponent §Next four bits for

Example Ten bit word §Sign of number §Sign of exponent §Next four bits for mantissa Next number 0 0 0 0 0 1 27/11/2020 8 http: //numericalmethods. eng. usf. edu

Relative Error and Machine Epsilon The absolute relative true error in representing a number

Relative Error and Machine Epsilon The absolute relative true error in representing a number will be less then the machine epsilon Example 10 bit word (sign, sign of exponent, 4 for mantissa) 0 Sign of the number 1 0 Sign of the exponent 1 1 exponent 0 1 1 0 0 mantissa 27/11/2020 9 http: //numericalmethods. eng. usf. edu

IEEE 754 Standards for Single Precision Representation http: //numericalmethods. eng. usf. edu 27/11/2020 http:

IEEE 754 Standards for Single Precision Representation http: //numericalmethods. eng. usf. edu 27/11/2020 http: //numericalmethods. eng. usf. e du 10

IEEE-754 Floating Point Standard • Standardizes representation of floating point numbers on different computers

IEEE-754 Floating Point Standard • Standardizes representation of floating point numbers on different computers in single and double precision. • Standardizes representation of floating point operations on different computers. 27/11/2020 http: //numericalmethods. eng. usf. e du 11

One Great Reference What every computer scientist (and even if you are not) should

One Great Reference What every computer scientist (and even if you are not) should know about floating point arithmetic! http: //www. validlab. com/goldberg/paper. pdf 27/11/2020 http: //numericalmethods. eng. usf. e du 12

IEEE-754 Format Single Precision 32 bits for single precision 0 0 0 0 0

IEEE-754 Format Single Precision 32 bits for single precision 0 0 0 0 0 0 0 0 Sign (s) 27/11/2020 13 Biased Exponent (e’) Mantissa (m) http: //numericalmethods. eng. usf. e du 13

Example#1 1 1 0 0 0 1 0 1 0 0 0 0 0

Example#1 1 1 0 0 0 1 0 1 0 0 0 0 0 Sign (s) 27/11/2020 14 Biased Exponent (e’) Mantissa (m) http: //numericalmethods. eng. usf. e du 14

Example#2 Represent -5. 5834 x 1010 as a single precision floating point number. ?

Example#2 Represent -5. 5834 x 1010 as a single precision floating point number. ? ? ? ? ? ? ? ? Sign (s) 27/11/2020 15 Biased Exponent (e’) Mantissa (m) http: //numericalmethods. eng. usf. e du 15

Exponent for 32 Bit IEEE-754 8 bits would represent Bias is 127; so subtract

Exponent for 32 Bit IEEE-754 8 bits would represent Bias is 127; so subtract 127 from representation 27/11/2020 16 http: //numericalmethods. eng. usf. e du 16

Exponent for Special Cases Actual range of and are reserved for special numbers Actual

Exponent for Special Cases Actual range of and are reserved for special numbers Actual range of 27/11/2020 http: //numericalmethods. eng. usf. e du 17

Special Exponents and Numbers all zeros all ones s 0 1 0 or 1

Special Exponents and Numbers all zeros all ones s 0 1 0 or 1 27/11/2020 all zeros all ones m Represents all zeros 0 all zeros -0 all zeros non-zero Na. N http: //numericalmethods. eng. usf. e du 18

IEEE-754 Format The largest number by magnitude The smallest number by magnitude Machine epsilon

IEEE-754 Format The largest number by magnitude The smallest number by magnitude Machine epsilon 27/11/2020 19 http: //numericalmethods. eng. usf. e du 19

Additional Resources For all resources on this topic such as digital audiovisual lectures, primers,

Additional Resources For all resources on this topic such as digital audiovisual lectures, primers, textbook chapters, multiple-choice tests, worksheets in MATLAB, MATHEMATICA, Math. Cad and MAPLE, blogs, related physical problems, please visit http: //numericalmethods. eng. usf. edu/topics/floatingpoint_re presentation. html 27/11/2020 http: //numericalmethods. eng. usf. e du 20

THE END http: //numericalmethods. eng. usf. edu 27/11/2020 http: //numericalmethods. eng. usf. e du

THE END http: //numericalmethods. eng. usf. edu 27/11/2020 http: //numericalmethods. eng. usf. e du 21