Binary Real Numbers. Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point.

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

CENG536 Computer Engineering department Çankaya University.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
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.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
Floating Point Numbers
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.
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:
Floating Point Numbers
Floating Point Numbers.  Floating point numbers are real numbers.  In Java, this just means any numbers that aren’t integers (whole numbers)  For example…
Number Systems Lecture 02.
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
Simple Data Type Representation and conversion of numbers
Numbers and number systems
ELEN 5346/4304 DSP and Filter Design Fall Lecture 12: Number representation and Quantization effects Instructor: Dr. Gleb V. Tcheslavski Contact:
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
Factional Values What is 0.75 in binary?. How could we represent fractions? In decimal: – As fractions : 1/5.
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.
Fixed-Point Arithmetics: Part II
Chapter 1 Data Storage(3) Yonsei University 1 st Semester, 2015 Sanghyun Park.
Number Systems So far we have studied the following integer number systems in computer Unsigned numbers Sign/magnitude numbers Two’s complement numbers.
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.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
9.4 FLOATING-POINT REPRESENTATION
Lecture 5. Topics Sec 1.4 Representing Information as Bit Patterns Representing Text Representing Text Representing Numeric Values Representing Numeric.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
©Brooks/Cole, 2003 Chapter 4 Operations on Bits. ©Brooks/Cole, 2003 Apply arithmetic operations on bits when the integer is represented in two’s complement.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Floating Point Arithmetic
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Binary Arithmetic.
IT1004: Data Representation and Organization Negative number representation.
©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.
Chapter 4 Operations on Bits. Apply arithmetic operations on bits when the integer is represented in two’s complement. Apply logical operations on bits.
R EPRESENTATION OF REAL NUMBER Presented by: Pawan yadav Puneet vinayak.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Learning Objectives 3.3.1f - Describe the nature and uses of floating point form 3.3.1h - Convert a real number to floating point form Learn how to normalise.
Software Design and Development Storing Data Computing Science.
Lesson Objectives Aims You should know about: Binary numbers ‘n’ that.
Floating Point Numbers
Introduction to Numerical Analysis I
Nat 4/5 Computing Science Lesson 1: Binary
Department of Computer Science Georgia State University
Fundamentals of Computer Science
Introduction To Computer Science
CSCI206 - Computer Organization & Programming
Number Representations
Storing Negative Integers
COMS 161 Introduction to Computing
靜夜思 床前明月光, 疑是地上霜。 舉頭望明月, 低頭思故鄉。 ~ 李白 李商隱.
Number Representations
1.6) Storing Integer: 1.7) storing fraction:
Chapter 1 Introduction.
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Presentation transcript:

Binary Real Numbers

Introduction Computers must be able to represent real numbers (numbers w/ fractions) Two different ways:  Fixed-point  Floating-point NOTE: Everything in binary uses powers of two

Decimal Review Digits to the right of the decimal point correspond to negative powers of

Binary Fractions /21/41/81/161/321/64

Fixed Point Notation 1. Multiply each 1 by the corresponding power of 2 2. Add up the resulting powers of 2 Example: = ¼ = = ¼ =

Floating-Point Notation Floating-point notation is essentially the computer’s way of storing a number that has been normalized 3 different parts of any number:  Mantissa: normalized number  Exponent: power to which the base is raised  Sign: of both mantissa and exponent Decimal Example: 12.5 = x 10 2  normalized!

Normalization Steps 1. Beginning with a fixed point number 2. Normalize the number such that the radix point (decimal point) is all the way to the left (produces the mantissa) 3. Multiply the resulting number by the base raised to an exponent

Floating-Point Example What is 12.5 in floating-point representation? 1. Convert 12.5 to binary fixed point = Normalize the number by moving the radix point, producing the mantissa = * Fill in the bits for each of the three parts of any real number: 1. Sign (2 bits) 2. Mantissa (# bits varies) 3. Exponent (# bits varies) 4. NOTE: 2’s complement may be applied to the mantissa or the exponent if either are negative

Placing the Bits Assume you have the following:  1 bit for the mantissa sign  8 bits for the mantissa  1 bit for the exponent sign  6 bits for the exponent S M M M M M M M M M S E E E E E E E Example: * 2 4 

Another Example Convert to binary: 1. Convert 12.5 to fixed point  Normalize  * Convert exponent base to binary: 4  s complement the mantissa by flipping bits and adding 1:  Final number 

Upper & Lower Bounds Assume you have the following:  1 bit for the mantissa sign  8 bits for the mantissa  1 bit for the exponent sign  6 bits for the exponent What is the upper bound for the floating-point number? What is the lower bound for the floating-point number? What happens if we convert a floating-point number to an integer?

Integers vs. Floating-point integers:  smaller range than floating-point  all numbers within the range are 100% accurate floating-point  large range of numbers  not all numbers within the range can be represented accurately Example: repeating

Possible Errors truncation error  round off errors using floating-point numbers because not all real numbers can be represented accurately overflow error  attempting to represent a number that is greater than the upper bound for the given number of bits underflow error  attempting to represent a number that is less than the lower bound for the given number of bits