CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.

Slides:



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

CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
1 IKI10230 Pengantar Organisasi Komputer Bab 6: Aritmatika 7 & 14 Mei 2003 Bobby Nazief Qonita Shahab bahan kuliah:
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real Numbers.
1 CS61C L9 Fl. Pt. © UC Regents CS61C - Machine Structures Lecture 9 - Floating Point, Part I September 27, 2000 David Patterson
COMP3221: Microprocessors and Embedded Systems Lecture 14: Floating Point Numbers Lecturer: Hui Wu Session 2, 2004.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
Booth’s Algorithm.
Inst.eecs.berkeley.edu/~cs61c CS61CL : Machine Structures Lecture #6 – Number Representation, IEEE FP Greet class Jeremy Huddleston.
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.
CS 61C L15 Floating Point I (1) Garcia, Spring 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C :
CS61C L11 Floating Point I (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 – Floating.
CS61C L15 Floating Point I (1) Garcia, Fall 2011 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS 61C L15 Floating Point I (1) Krause, Spring 2005 © UCB This day in history… TA Danny Krause inst.eecs.berkeley.edu/~cs61c-td inst.eecs.berkeley.edu/~cs61c.
CS 61C L15 Floating Point I (1) Garcia, Fall 2004 © UCB Lecturer PSOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
1 Lecture 4: Arithmetic for Computers (Part 5) CS 447 Jason Bakos.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
CS 61C L10 Floating Point (1) A Carle, Summer 2005 © UCB inst.eecs.berkeley.edu/~cs61c/su05 CS61C : Machine Structures Lecture #10: Floating Point
CS61C L15 Floating Point I (1) Jacobs, Spring 2008 © UCB TA Ordinaire Dave Jacobs inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L15 Floating Point I (1) Garcia, Spring 2007 © UCB Lecturer SOE Dan Garcia inst.eecs.berkeley.edu/~cs61c CS61C : Machine.
CS61C L15 Floating Point I (1) Garcia, Fall 2006 © UCB #16 Cal rolls over OSU  Behind the arm of Nate Longshore’s 341 yds passing & 4 TDs, the Bears roll.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Science 210 Computer Organization Floating Point Representation.
School of Computer Science G51CSA 1 Computer Arithmetic.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
IT 251 Computer Organization and Architecture Introduction to Floating Point Numbers Chia-Chi Teng.
Computer Arithmetic Nizamettin AYDIN
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
Csci 136 Computer Architecture II – Floating-Point Arithmetic
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
CS61C L11 Floating Point (1) Pearce, Summer 2010 © UCB inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Lecture 11 Floating Point
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.
Data Representation in Computer Systems
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
CSC 221 Computer Organization and Assembly Language
FLOATING POINT ARITHMETIC P&H Slides ECE 411 – Spring 2005.
CS 61C L3.2.1 Floating Point 1 (1) K. Meinz, Summer 2004 © UCB CS61C : Machine Structures Lecture Floating Point Kurt Meinz inst.eecs.berkeley.edu/~cs61c.
CHAPTER 3 Floating Point.
CDA 3101 Fall 2013 Introduction to Computer Organization
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.
COSC2410: LAB 2 BINARY ARITHMETIC SIGNED NUMBERS FLOATING POINT REPRESENTATION BOOLEAN ALGEBRA 1.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Fundamentals of Computer Science
Dr. Clincy Professor of CS
CS 232: Computer Architecture II
April 2006 Saeid Nooshabadi
William Stallings Computer Organization and Architecture 7th Edition
Topic 3d Representation of Real Numbers
ECE/CS 552: Floating Point
Number Representations
CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic
Hello to Robb Neuschwander listening from Louisville, KY!
Floating Point Numbers
Lecturer PSOE Dan Garcia
COMS 161 Introduction to Computing
Topic 3d Representation of Real Numbers
Numbers with fractions Could be done in pure binary
Number Representations
Presentation transcript:

CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson & Hennessy, ©2005 Some slides and/or pictures in the following are adapted from: slides ©2008 UCB 11

Representation of Fractions “Binary Point” like decimal point signifies boundary between integer and fractional parts: xx. yyyy Example 6-bit representation: = 1x x x2 -3 = If we assume “fixed binary point”, range of 6-bit representations with this format: 0 to (almost 4)

Fractional Powers of / / / / / i 2 -i

Representation of Fractions So far, in our examples we used a “fixed” binary point. What we really want is to “float” the binary point. Why? Floating binary point most effective use of our limited bits (and thus more accuracy in our number representation): … … Any other solution would lose accuracy! example: put into binary. Represent as in 5-bits choosing where to put the binary point. Store these bits and keep track of the binary point 2 places to the left of the MSB With floating point rep., each numeral carries a exponent field recording the whereabouts of its binary point. The binary point can be outside the stored bits, so very large and small numbers can be represented.

x radix (base) decimal pointsignificand exponent Normalized form: no leadings 0s (exactly one digit to left of decimal point) Alternatives to representing 1/1,000,000,000 –Normalized: 1.0 x –Not normalized: 0.1 x 10 -8,10.0 x Scientific Notation (in Decimal)

1.0 two x 2 -1 radix (base) “binary point” exponent Computer arithmetic that supports it called floating point, because it represents numbers where the binary point is not fixed, as it is for integers –Declare such variable in C as float significand Scientific Notation (in Binary)

Normal format: +1.xxxxxxxxxx two *2 yyyy two 32-bit version (C “ float ”) 0 31 SExponent Significand 1 bit8 bits23 bits S represents Sign Exponent represents y’s Significand represents x’s Floating Point Representation

Normal format: +1.xxxxxxxxxx two *2 yyyy two 32-bit version (C “ float ”) Positive and negative numbers closest to zero? (done in class) Positive and negative numbers furthest from zero? (done in class) 0 31 SExponent Significand 1 bit8 bits23 bits Floating Point Representation

What if result too large? –Overflow!  Exponent larger than represented in 8-bit Exponent field What if result too small? –Underflow!  Negative exponent larger than represented in 8-bit Exponent field What would help reduce chances of overflow and/or underflow? 0 1 underflow overflow Floating Point Representation

64 bit version (C “ double ”) Double Precision (vs. Single Precision) –C variable declared as double –Positive and negative numbers closest to zero? (done in class) –Positive and negative numbers furthest from zero? (done in class) –But primary advantage is greater accuracy due to larger significand 0 31 SExponent Significand 1 bit11 bits20 bits Significand (cont’d) 32 bits Double Precision Fl. Pt. Representation

Next Multiple of Word Size (128 bits) –Unbelievable range of numbers –Unbelievable precision (accuracy) Currently being worked on (IEEE 754r) –Current version has 15 exponent bits and 112 significand bits (113 precision bits) Oct-Precision? –Some have tried, no real traction so far Half-Precision? –Yep, that’s for a short (16 bit) en.wikipedia.org/wiki/Quad_precision en.wikipedia.org/wiki/Half_precision QUAD Precision Fl. Pt. Representation

Single Precision (DP similar): Sign bit:1 means negative, 0 means positive Significand: –To pack more bits, leading 1 implicit for normalized numbers – bits single, bits double –always true: 0 < Significand < 1 (for normalized numbers) Note: 0 has no leading 1, so reserve exponent value 0 just for number SExponent Significand 1 bit8 bits23 bits IEEE 754 Floating Point Standard

IEEE 754 uses “biased exponent” representation –Designers wanted FP numbers to be used even if no FP hardware; e.g., sort records with FP numbers using integer compares –Wanted bigger (integer) exponent field to represent bigger numbers –2’s complement poses a problem (because negative numbers look bigger) IEEE 754 Floating Point Standard

Called Biased Notation, where bias is number subtracted to get real number –IEEE 754 uses bias of 127 for single precision –Subtract 127 from Exponent field to get actual value for exponent –1023 is bias for double precision Summary (single precision): 0 31 SExponent Significand 1 bit8 bits23 bits (-1) S x (1 + Significand) x 2 (Exponent-127) –Double precision identical, except with exponent bias of 1023 (half, quad similar) IEEE 754 Floating Point Standard