M68K Assembly Language Programming Bob Britton Chapter 12 IEEE Floating Point Notice: Chapter slides in this series originally provided by B.Britton. This.

Slides:



Advertisements
Similar presentations
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Advertisements

2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Chapter 2: Data Representation
Principles of Computer Architecture Miles Murdocca and Vincent Heuring Chapter 2: Data Representation.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Datorteknik FloatingPoint bild 1 Floating point Number system corresponding to the decimal notation 1,837 * 10 significand exponent a great number of corresponding.
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real Numbers.
Chapter 1.7 Storing Fractions. Excess Notation, continued… In this notation, "m" indicates the total number of bits. For us (working with 8 bits), it.
1 Lecture 9: Floating Point Today’s topics:  Division  IEEE 754 representations  FP arithmetic Reminder: assignment 4 will be posted later today.
Assembly Language and Computer Architecture Using C++ and Java
Assembly Language and Computer Architecture Using C++ and Java
Floating Point Numbers
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Science 210 Computer Organization Floating Point Representation.
Computer Organization CS345 David Monismith Based upon notes by Dr. Bill Siever and notes from the Patterson and Hennessy Text.
Chapter 3 Data Representation part2 Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2010.
Binary Representation and Computer Arithmetic
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
Data Representation Number Systems.
Simple Data Type Representation and conversion of numbers
Ch. 2 Floating Point Numbers
Computer Arithmetic Nizamettin AYDIN
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Principles of Computer.
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
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.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
Lecture 9: Floating Point
CSC 221 Computer Organization and Assembly Language
16. Binary Numbers Programming in C++ Computer Science Dept Va Tech August, 1999 © Barnette ND, McQuain WD, Keenan MA 1 Binary Number System Base.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Floating Point Representation.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Number Systems & Operations
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
FAMU-FSU College of Engineering 1 Part III The Arithmetic/Logic Unit.
Data Representation: Floating Point for Real Numbers Computer Organization and Assembly Language: Module 11.
IT11004: Data Representation and Organization Floating Point Representation.
Numbers in Computers.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Number Systems. The position of each digit in a weighted number system is assigned a weight based on the base or radix of the system. The radix of decimal.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point Representations
Computer Science 210 Computer Organization
Dr. Clincy Professor of CS
Floating Point Math & Representation
Lecture 9: Floating Point
Floating Point Number system corresponding to the decimal notation
Topic 3d Representation of Real Numbers
Luddy Harrison CS433G Spring 2007
CSCI206 - Computer Organization & Programming
Number Representations
Data Representation Data Types Complements Fixed Point Representation
(Part 3-Floating Point Arithmetic)
Number Representation
Floating Point Numbers
Number Representations
Presentation transcript:

M68K Assembly Language Programming Bob Britton Chapter 12 IEEE Floating Point Notice: Chapter slides in this series originally provided by B.Britton. This version of chapter 12 slides have been modified by R.Renner to reflect Spring 2006 course content.

Typically floating-point numbers are used in scientific and engineering calculations. For example the velocity of light is 186,281.7 miles per second. A light year, the distance traveled by light in one year is 5,880,000,000,000 miles. The atomic weight of hydrogen is A micron, which is one millionth of a meter, is inches. Below, each of these numbers is represented in normalized scientific notation x x x x 10 -7

There is a 32-bit (single precision), and a 64-bit (double precision) IEEE standard. In the single precision format, 7 decimal digits of precision can be encoded, and the exponent scale factor has a range of approximately In the double precision format, 16 decimal digits of precision can be encoded, and the exponent scale factor has a range of approximately

Binary Floating-Point to Decimal Floating-Point Conversion In general, a floating-point number has an integer part and a fractional part. For example given the floating point decimal number , two hundred ninety-five is the integer part and 0.48 is the fractional part. Any decimal floating-point number has a polynomial expansion. For example the polynomial expansion for the decimal value is: 2 * * * * * 10 -2

By the same token, a binary floating-point binary number has a polynomial expansion. For example the polynomial expansion for the binary floating-point value is: 1 * * * * * * 2 -3 Finding the decimal equivalent of any floating-point binary number simply involves evaluating the polynomial expansion. You will find the following table for the powers of two extremely useful when performing this conversion process Using this table we evaluate the polynomial for the binary number as: 1*4 + 0*2 + 1*1 + 1* * *0.125 = 5.625

Decimal Floating-Point to Binary Floating-Point Conversion Suppose we want to find the binary floating-point equivalent of the decimal number To convert a decimal integer to binary we repeatedly dividing by 2 and record the remainder after each division. For example the decimal value 25 is equivalent to in binary. Suppose we want to find the binary floating-point equivalent of the decimal number The process of finding the binary equivalent of the decimal fraction portion involves repeatedly multiplying the decimal fraction by two and recording the integer value portion of one (1) or zero (0) that is produced.

Given this procedure let’s find the binary equivalent of the decimal value First Digit after binary point0. 5 Second Digit after binary point1. 0 Done So we now can say that the decimal value is represented in binary as:

As a second example we will convert the decimal vale 12.2 to binary. We should have no difficulty in finding that the decimal value 12 is represented in binary as We now need to find the binary equivalent of the decimal fraction First digit after binary point0. 4 Second digit after binary point0. 8 Third digit after binary point1. 6 Forth digit after binary point1. 2 The above sequence repeats forever So we now can say that the decimal value 12.2 cannot be represent exactly in binary, but a close approximation is:

The IEEE 754 Floating-Point Standard The IEEE 754 single precision floating-point format is illustrated below: 8-bit 23-bit Sign Biased exponentSignificand The IEEE 754 single precision floating-point format specifies three distinct fields: The sign of the number (0: positive, 1: negative) The biased exponent (The actual exponent value plus 127) A value for the significand, which is the magnitude of the binary fractional portion

Procedure to encode a binary floating-point value in the IEEE format You recall that is the binary equivalent of in the decimal number system. (A correction to the book is shown here) Enter a value for the sign bit (0: positive, 1: negative) Normalize the binary representation so that the binary point is to the right of the first one (1) = = x Add 127 ( ) to the actual exponent and place this value into the 8-bit biased exponent field. For this example we would get: = 131 = ( ) 10 2 Fill in the 23-bit significand field with all the digits to the right of the binary point that appear in the normalized representation. Since all normalized numbers (except zero) have a leading one (1) this bit does not occupy a position within the encoding. This implicit bit is called the “hidden-bit.”

Special Encodings Any non zero value /1 Not a Number /1Infinity Any non zero value /1Denomalized /1Zero SignificandExponent sign Interpretation

Decoding Numbers the IEEE 754 Floating-Point Standard A specific example will be provided to demonstrate the rules. Suppose we are given the following IEEE single precision binary floating-point representation for a number, and we want to determine the equivalent value as a floating-point decimal number The first bit indicates the sign of the number (0: positive, 1: negative). For this example, we have a negative decimal number encoded. Subtract 127 from the value found in the biased exponent field to determine the actual exponent. For this example the actual exponent is 6. ( = 6) Using the significand bits write the number in normalized binary representation. Remember to include the recreated hidden-bit and an indication of the sign of the number. For this example, we have x 2 6 Denormalize the number by moving the binary point the number of positions indicated by the actual exponent. For our example, the de-normalized number is: In the final step we simply perform a binary to decimal conversion by evaluating the polynomial expansion of the binary number. For this example we determine that is the equivalent decimal value.

IEEE 757 Floating Point Representation Practice Conversions ten = two =>> x What is the decimal equivalent of the following number given in IEEE 757 floating point notation?

One More Exercise 10.5 ten = two =>> x