IT11004: Data Representation and Organization

Slides:



Advertisements
Similar presentations
Spring 2013 Advising Starts this week! CS2710 Computer Organization1.
Advertisements

Fabián E. Bustamante, Spring 2007 Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating Point (FLP) Representation A Floating Point value: f = m*r**e Where: m – mantissa or fractional r – base or radix, usually r = 2 e - exponent.
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real Numbers.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Floating Point Numbers. CMPE12cGabriel Hugh Elkaim 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or.
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
Floating Point Numbers. CMPE12cCyrus Bazeghi 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or 2 64.
Floating Point Numbers
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Science 210 Computer Organization Floating Point Representation.
Binary Representation and Computer Arithmetic
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
Fixed-Point Arithmetics: Part II
Floating Point Numbers Topics –IEEE Floating Point Standard –Rounding –Floating Point Operations –Mathematical properties.
Data Representation - Part II. Characters A variable may not be a non-numerical type Character is the most common non- numerical type in a programming.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
9.4 FLOATING-POINT REPRESENTATION
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Floating Point Representation.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
1 COMS 161 Introduction to Computing Title: Numeric Processing Date: November 08, 2004 Lecture Number: 30.
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
IT11004: Data Representation and Organization Floating Point Representation.
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.
Floating Point (FLP) Representation
FLOATING-POINT NUMBER REPRESENTATION
CSCI206 - Computer Organization & Programming
Floating Point Numbers
Floating Point Representations
Computer Science 210 Computer Organization
Data analysis and modeling: the tools of the trade
Number Representation
2.4. Floating Point Numbers
Floating Point Representations
Data Representation Binary Numbers Binary Addition
Recitation 4&5 and review 1 & 2 & 3
Topics IEEE Floating Point Standard Rounding Floating Point Operations
CS 105 “Tour of the Black Holes of Computing!”
Numbers in a Computer Unsigned integers Signed magnitude
CS 232: Computer Architecture II
William Stallings Computer Organization and Architecture 7th Edition
Data Structures Mohammed Thajeel To the second year students
Topic 3d Representation of Real Numbers
CSCI206 - Computer Organization & Programming
Data Representation Data Types Complements Fixed Point Representation
CSCI206 - Computer Organization & Programming
Computer Science 210 Computer Organization
CS 105 “Tour of the Black Holes of Computing!”
Approximations and Round-Off Errors Chapter 3
Floating Point Arithmetic August 31, 2009
CS 105 “Tour of the Black Holes of Computing!”
Faculty of Cybernetics, Statistics and Economic Informatics –
CS 105 “Tour of the Black Holes of Computing!”
CS213 Floating Point Topics IEEE Floating Point Standard Rounding
COMS 161 Introduction to Computing
Topic 3d Representation of Real Numbers
CS 105 “Tour of the Black Holes of Computing!”
Numbers with fractions Could be done in pure binary
Computer Organization and Assembly Language
Lecture 9: Shift, Mult, Div Fixed & Floating Point
CS 105 “Tour of the Black Holes of Computing!”
Presentation transcript:

IT11004: Data Representation and Organization www.hndit.com IT11004: Data Representation and Organization Floating Point Representation

normalized form www.hndit.com A real number is called normalized, if it is in the form: d0.d1d2d3…x10n where n is an integer, d1d2d3… are the digits of the number in base 10, and d0 is not zero. As examples, the number 918.082 in normalized form is 9.18082x102 the number -0.00574012 in normalized form is -5.74012x10-3 Clearly, any non-zero real number can be normalized.

Floating Point Precisions www.hndit.com s exp frac Encoding MSB is sign bit exp field encodes E frac field encodes M Sizes Single precision: 8 exp bits, 23 frac bits 32 bits total Double precision: 11 exp bits, 52 frac bits 64 bits total Extended precision: 15 exp bits, 63 frac bits Only found in Intel-compatible machines Stored in 80 bits 1 bit wasted

Single-precision floating-point format (binary32) www.hndit.com Single-precision floating-point format (binary32) A computer number format that occupies 4 bytes (32 bits) in computer memory and represents a wide dynamic range of values by using a floating point. One of the first programming languages to provide single- and double-precision floating-point data types was Fortran. Single-precision binary floating-point is used due to its wider range over fixed point Single precision is known as float in C, C++, C#, Java[1], and Haskell, and single in Pascal, Visual Basic, and MATLAB.

IEEE single-precision binary floating-point format: binary32 www.hndit.com IEEE single-precision binary floating-point format: binary32

convert a base 10 real number into binary32 format www.hndit.com consider a real number with an integer and a fraction part such as 12.375 Convert the integer part into binary convert the fraction part using the following technique add the two results and adjust them to produce a proper final conversion Conversion of the fractional part 0.375 x 2 = 0.750 0.750 x 2 = 1.500 0.500 x 2 = 1.000 fraction = 0.000, terminate (0.375)10 can be exactly represented in binary as (0.011)2 Therefore (12.375)10 = (12)10 + (0.375)10 = (1100)2 + (0.011)2 = (1100.011)2 In normalized form (12.375)10 = 1.1000112x23

convert a base 10 real number into binary32 format… www.hndit.com convert a base 10 real number into binary32 format… In normalized form (12.375)10 = 1.1000112x23 From which we deduce: The exponent is 3 (and in the biased form it is therefore 127+3 =130 = 1000 0010) The fraction is 100011 (looking to the right of the binary point) From these we can form the resulting 32 bit IEEE 754 binary32 format representation of 12.375 as: 0-10000010-10001100000000000000000 = 41460000H

Ex 1 Consider a value 0.25 . We can see that : (0.25)10 =(1.0)2x2-2 www.hndit.com 0.25 x 2 = 0.5 0.5 x 2 = 1.0 0.2510 = 0.012 Consider a value 0.25 . We can see that : (0.25)10 =(1.0)2x2-2 From which we deduce : The exponent is −2 (and in the biased form it is 127+(−2)= 125 = 0111 1101 ) The fraction is 0 (looking to the right of binary point in 1.0 is all zeros) From these we can form the resulting 32 bit IEEE 754 binary32 format representation of real number 0.25 as: 0-01111101-00000000000000000000000 = 3e800000H

Ex 2 www.hndit.com Convert 113.21 into binary 32 floating point format

Double-precision floating-point format (binary64) www.hndit.com a computer number format that occupies two adjacent storage locations in computer memory. A double-precision number, sometimes simply called a double, may be defined to be an integer, fixed point, or floating point binary64 is having: Sign bit: 1 bit Exponent width: 11 bits Significand precision: 52 bits www.hndit.com