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.

Slides:



Advertisements
Similar presentations
2-1 Chapter 2 - Data Representation Computer Architecture and Organization by M. Murdocca and V. Heuring © 2007 M. Murdocca and V. Heuring Computer Architecture.
Advertisements

Chapter 2: Data Representation
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Floating Point Numbers
Representing Information as Bit Patterns
Assembly Language and Computer Architecture Using C++ and Java
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.
Signed Numbers.
M68K Assembly Language Programming Bob Britton Chapter 12 IEEE Floating Point Notice: Chapter slides in this series originally provided by B.Britton. This.
Assembly Language and Computer Architecture Using C++ and Java
2-1 Computer Organization Part Fixed Point Numbers Using only two digits of precision for signed base 10 numbers, the range (interval between lowest.
Floating Point Numbers
Representing Real Numbers Using Floating Point Notation Lecture 6 CSCI 1405, CSCI 1301 Introduction to Computer Science Fall 2009.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Number Representation Rizwan Rehman, CCS, DU. Convert a number from decimal to binary notation and vice versa. Understand the different representations.
Computer Science 210 Computer Organization Floating Point Representation.
The IEEE Format for storing float (single precision) data type Use the “enter” key to proceed through the show.
Lecture 8 Floating point format
Operations on data CHAPTER 4.
4 Operations On Data Foundations of Computer Science ã Cengage Learning.
Binary Number Systems.
Binary Representation and Computer Arithmetic
Chapter3 Fixed Point Representation Dr. Bernard Chen Ph.D. University of Central Arkansas Spring 2009.
The Binary Number System
Data Representation Number Systems.
Simple Data Type Representation and conversion of numbers
Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.
Information Representation (Level ISA3) Floating point numbers.
2-1 Chapter 2 - Data Representation Principles of Computer Architecture by M. Murdocca and V. Heuring © 1999 M. Murdocca and V. Heuring Chapter Contents.
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Computer Science 111 Fundamentals of Programming I Number Systems.
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Computer Architecture
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
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
9.4 FLOATING-POINT REPRESENTATION
Binary Fractions. Fractions A radix separates the integer part from the fraction part of a number Columns to the right of the radix have negative.
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
©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.
Negative Numbers An alternative way to find the 2's complement Starting at the right 1. Copy bits until you reach the first Flip all the remaining.
Operators & Identifiers The Data Elements. Arithmetic Operators exponentiation multiplication division ( real ) division ( integer quotient ) division.
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.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
CSPP58001 Floating Point Numbers. CSPP58001 Floating vs. fixed point Floating point refers to a binary decimal representation where there is not a fixed.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.6 Instructor: Lin Chen Sept 2013.
Floating Point in Binary 1.Place Value Chart:
Floating Point Numbers
©Brooks/Cole, 2003 Chapter 3 Number Representation.
COMPUTER SCIENCE Data Representation and Machine Concepts Section 1.7 Instructor: Lin Chen Sept 2013.
Representation of Data (Part II) Computer Studies Notes: chapter 19 Ma King Man.
Computer Organization 1 Data Representation Negative Integers.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Binary Fractions.
Introduction To Computer Science
Data Structures Mohammed Thajeel To the second year students
Number Representation
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Storing Integers and Fractions
OBJECTIVES After reading this chapter, the reader should be able to :
1.6) Storing Integer: 1.7) storing fraction:
Presentation transcript:

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 would be excess 2^7. To represent a number (positive or negative) in excess 2^7, begin by taking the number in regular binary representation. Then add 2^7 (=128) to that number. For example, 7 would be =135, or 2^7+2^2+2^1+2^0, and, in binary, We would represent -7 as =121, and, in binary, Note: Unless you know which representation has been used, you cannot figure out the value of a number. A number in excess 2^(m-1) is the same as that number in two's complement with the leftmost bit flipped.

Chapter 1.7 Storing Fractions

Chapter 1.7 Storing Fractions In contrast to the storage of integers, the storage of a value with a fractional part requires that we store not only the pattern of 0s and 1s representing its binary representation, but also the position of the radix point. A popular way of doing this is based on scientific notation and is called floating- point notation.

Floating-Point Notation Let us explain floating-point notation with an example using only one byte of storage. Although machines normally use much longer patterns, this eight-bit format is representative of actual systems and serves to demonstrate the important concepts without the clutter of long bit patterns.

Floating-Point Notation We first designate the high-order bit of the byte as the sign bit.  0 – nonnegative  1 – negative

Floating-Point Notation Next, we divide the remaining seven bits of the byte into two groups, or fields  Exponent field  Mantissa field

Floating-Point Notation Let us designate the three bits following the sign bit as the exponent field and the remaining four bits as the mantissa field.

Floating-Point Notation We can explain the meaning of the fields by considering the following example:  Suppose a byte contains the bit pattern

Floating-Point Notation Analyzing this pattern with the preceding format, we see that the sign bit is 0, the exponent is 110, and the mantissa is 1011.

Floating-Point Notation left side To decode the byte, we first extract the mantissa and place a radix point on its left side, obtaining .1011

Floating-Point Notation Next, we extract the contents of the exponent field and interpret it as an integer stored using the three-bit excess method.

Floating-Point Notation Thus the pattern in the exponent field in our example represents a positive 2  110 -> 2 excess notation.  Remember what the others are? 100 -> 0 etc

Floating-Point Notation The exponent field is +2 This tells us to move the radix in our solution to the RIGHT by two bits.  A positive exponent means to move the radix to the right  A negative exponent means to move the radix to the left

Floating-Point Notation So we have: What is it represent in decimal? 2 ¾ Remember fractions in binary?

Floating-Point Notation Review of fractions in binary:

Floating-Point Notation The part at the left to the radix point is  10 The part at the right to the radix point is  > > 1* ½ + 1* ¼ -> ¾ So the number altogether is 2 ¾

Floating-Point Notation Don’t forget the SIGN BIT In this example, it is So, the sign bit is 0 It is nonnegative So, we can conclude that the byte represents 2 ¾

Floating-Point Notation 1 byte -> 8 bits This need to be memorized

Floating-Point Notation Let’s do another example First of all, we extract it Sign bit 1 Exponent011 Mantissa1100

Floating-Point Notation Mantissa.1100 Exponent 011 which means -1 move the radix to the left which represent 3/8 SIGN BIT1 which means negative

Floating-Point Notation The pattern represents – 3/8 Some more examples

Floating-Point Notation To store a value using floating point notation. We reverse the process. For example, to encode 1(1/8)

Floating-Point Notation First we express it in binary notation and obtain: Because it is positive, so the sign bit is 0 Now we can copy the bit pattern into the mantissa field from left to right, starting with the left most 1 in the binary representation. _ _ _ _ 1001

Floating-Point Notation _ _ _ _ 1001 Also we have the sign bit is 0 since it’s positive number, so we have 0 _ _ _ 1001 Since it is 1.001,.1001->1.001, the radix point moves to the right one bit. So, we need the 1 at the exponent field Which is 101

Floating-Point Notation So, we filled out all the fields at this point Number 1 1/8 is

Floating-Point Notation Note, there is a subtle point you may have missed when filling in the mantissa field. The rule is to copy the bit pattern appearing in the binary representation from left to right, STARTING WITH THE LEFTMOST 1 Example, 3/8 is.011 in binary, in mantissa it will be1100 Instead of 0110

Floating-Point Notation This is because we fill in the mantissa field starting with the leftmost 1 that appears in the binary representation. This rule eliminates the possibility of multiple representations for the same value. This representation is said to be in normalized form.

Floating-Point Notation If we don’t normalize them, for the same number, there can be more than one representation. For example: 3/8 It can be Or Etc.

Floating-Point Notation Truncation Error or Round-off Error

Floating-Point Notation

Homework #6 Page 60 Question 1 a,e 2 b,e 3 Due next Thursday. Remember to write your name and student ID on your homework.