Floating Point Numbers

Slides:



Advertisements
Similar presentations
4. Floating Point Numbers. Exponential Notation The representations differ in that the decimal place – the “point” -- “floats” to the left or right (with.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Floating Point Numbers
1 CSE1301 Computer Programming Lecture 30: Real Number Representation.
Chapter 5 Floating Point Numbers. Real Numbers l Floating point representation is used whenever the number to be represented is outside the range of integer.
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Floating Point Numbers
Representing Real Numbers Using Floating Point Notation Lecture 6 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
Computer Science 210 Computer Organization Floating Point Representation.
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
The IEEE Format for storing float (single precision) data type Use the “enter” key to proceed through the show.
Lecture 8 Floating point format
COMP201 Computer Systems Number Representation. Number Representation Introduction Number Systems Integer Representations Examples  Englander Chapter.
Binary Number Systems.
3. Representing Integer Data
The Binary Number System
Simple Data Type Representation and conversion of numbers
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
S. Rawat I.I.T. Kanpur. Floating-point representation IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent We can represent.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Floating Point Arithmetic
ITEC 1011 Introduction to Information Technologies 4. Floating Point Numbers Chapt. 5.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Floating Point Representation.
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Fractions in Binary.
CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Floating Point in Binary 1.Place Value Chart:
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
Floating Point Binary A2 Computing OCR Module 2509.
Number Representation and Arithmetic Circuits
©Brooks/Cole, 2003 Chapter 3 Number Representation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Chapter 9 Computer Arithmetic
FLOATING-POINT NUMBER REPRESENTATION
Floating Point Numbers
Floating Point Representations
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Introduction To Computer Science
Floating Point Number system corresponding to the decimal notation
William Stallings Computer Organization and Architecture 7th Edition
Data Structures Mohammed Thajeel To the second year students
ECEG-3202 Computer Architecture and Organization
Number Representation
COMS 161 Introduction to Computing
Chapter3 Fixed Point Representation
Numbers with fractions Could be done in pure binary
OBJECTIVES After reading this chapter, the reader should be able to :
Presentation transcript:

Floating Point Numbers Chapter 5

Exponential Notation The following are equivalent representations of 1,234 123,400.0 x 10-2 12,340.0 x 10-1 1,234.0 x 100 123.4 x 101 12.34 x 102 1.234 x 103 0.1234 x 104 The representations differ in that the decimal place – the “point” -- “floats” to the left or right (with the appropriate adjustment in the exponent). p. 122

Parts of a Floating Point Number Sign of mantissa Location of decimal point Mantissa Exponent Sign of exponent Base -0.9876 x 10-3 p. 123

IEEE 754 Standard Most common standard for representing floating point numbers Single precision: 32 bits, consisting of... Sign bit (1 bit) Exponent (8 bits) Mantissa (23 bits) Double precision: 64 bits, consisting of… Exponent (11 bits) Mantissa (52 bits)

Single Precision Format 32 bits Mantissa (23 bits) Exponent (8 bits) Sign of mantissa (1 bit)

Double Precision Format 64 bits Mantissa (52 bits) Exponent (11 bits) Sign of mantissa (1 bit) kc

Normalization The mantissa is normalized Has an implied decimal place on left Has an implied “1” on left of the decimal place E.g., Mantissa: Representation: 10100000000000000000000 1.1012 = 1.62510

Excess Notation To include both positive and negative exponents, “excess-n” notation is used Single precision: excess 127 Double precision: excess 1023 The value of the exponent stored is n larger than the actual exponent E.g., – excess 127, Exponent: Representation: 10000111 135 – 127 = 8 (value) Ed kc

Excess Notation - Sample - Represent exponent of 1410 in excess 127 form: 12710 = + 011111112 1410 = + 000011102 Representation = 100011012 Ed kc kc

Excess Notation - Sample - Represent exponent of -810 in excess 127 form: 12710 = + 011111112 - 810 = - 000010002 Representation = 011101112 Ed kc kc

Example Single precision +1.75  23 = 14.0 0 10000010 11000000000000000000000 1.112 = 1.7510 130 – 127 = 3 0 = positive mantissa +1.75  23 = 14.0

Exercise – Floating Point Conversion (1) What decimal value is represented by the following 32-bit floating point number? Answer: 1 10000010 11110110000000000000000 Skip answer Answer

Exercise – Floating Point Conversion (1) Answer What decimal value is represented by the following 32-bit floating point number? Answer: -15.6875 1 10000010 11110110000000000000000

Step by Step Solution To decimal form 23 1.9609375 = 15.6875 1 10000010 11110110000000000000000 To decimal form 130 - 127 = 3 1.11110110000000000000000000 1 + .5 + .25 + .125 + .0625 + 0 + .015625 + .0078125 23 1.9609375 = 15.6875 * - 15.6875 ( negative )

Step by Step Solution : Alternative Method 1 10000010 11110110000000000000000 To decimal form 130 - 127 = 3 1.11110110000000000000000000 Shift “Point” 1111.10110000000000000000000 - 15.6875 ( negative ) kc

Exercise – Floating Point Conversion (2) Express 3.14 as a 32-bit floating point number Answer: (Note: only use 10 significant bits for the mantissa) Skip answer Answer

Exercise – Floating Point Conversion (2) Answer Express 3.14 as a 32-bit floating point number Answer: (Note: only use 10 significant bits for the mantissa) 0 10000000 10010001111000000000000

Detail Solution : 3.14 to IEEE double precision 3.14 To Binary (approx): 11.001000111101 Delete implied left-most “1” and normalize 1001000111101 Poof ! Exponent = 127 + 1 position point moved when normalized 10000000 Value is positive: Sign bit = 0 0 10000000 10010001111010000000000

Packed Decimal Format - 1 of 4 * Somewhat limited use: eg: Where precision particularly important, as in accounting functions. * Similar to BCD: eg: Four bit representation, as in BCD. -> Stores two digits per byte. kc

Packed Decimal Format - 2 of 4 * Stores up to 31 digits * Last four bits for sign: - 1100 -> positive - 1101 -> negative - 1111 -> unsigned * Decimal Point not stored: must be maintained by separate (application) software. kc

Packed Decimal Format - 3 of 4 Example: Decimal Value: 10357, unsigned Packed Decimal: 0001 0000 0011 0101 0111 1111 Byte 1 Byte 2 Byte 3 kc

Packed Decimal Format - 4 of 4 Example: Decimal Value: - 90413 Packed Decimal: 1001 0000 0100 0001 0111 1101 Byte 1 Byte 2 Byte 3 kc

That’s all this time !! Thank you