CS 286 Computer Architecture & Organization

Slides:



Advertisements
Similar presentations
Fixed Point Numbers The binary integer arithmetic you are used to is known by the more general term of Fixed Point arithmetic. Fixed Point means that we.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CENG536 Computer Engineering department Çankaya University.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
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.
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)
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
ECEN 248 Integer Multiplication, Number Format Adopted from Copyright 2002 David H. Albonesi and the University of Rochester.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
Computer Science 210 Computer Organization Floating Point Representation.
Number Systems II Prepared by Dr P Marais (Modified by D Burford)
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.
Computing Systems Basic arithmetic for computers.
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,
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.
Integer and Fixed Point P & H: Chapter 3
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
1 CE 454 Computer Architecture Lecture 4 Ahmed Ezzat The Digital Logic, Ch-3.1.
Floating Point (FLP) Representation
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Floating Point Representations
Fundamentals of Computer Science
Computer Science 210 Computer Organization
Introduction To Computer Science
Computer Architecture & Operations I
2.4. Floating Point Numbers
Floating Point Representations
Data Representation Binary Numbers Binary Addition
Integer Division.
Lecture 9: Floating Point
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
IEEE floating point format
April 2006 Saeid Nooshabadi
PRESENTED BY J.SARAVANAN. Introduction: Objective: To provide hardware support for floating point arithmetic. To understand how to represent floating.
William Stallings Computer Organization and Architecture 7th Edition
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
EEL 3705 / 3705L Digital Logic Design
Floating Point Representation
CS 61C: Great Ideas in Computer Architecture Floating Point Arithmetic
Computer Science 210 Computer Organization
How to represent real numbers
How to represent real numbers
ECEG-3202 Computer Architecture and Organization
October 17 Chapter 4 – Floating Point Read 5.1 through 5.3 1/16/2019
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Chapter 8 Computer Arithmetic
Numbers representations
Floating Point Numbers
COMS 161 Introduction to Computing
Topic 3d Representation of Real Numbers
Floating Point Numbers
Numbers with fractions Could be done in pure binary
Number Representations
Lecture 9: Shift, Mult, Div Fixed & Floating Point
Presentation transcript:

CS 286 Computer Architecture & Organization Floating-Point Numbers & IEEE-754 Department of Computer Science Southern Illinois University Edwardsville Fall, 2018 Dr. Hiroshi Fujinoki E-mail: hfujino@siue.edu IEEE754/001

CS 286 Computer Architecture & Organization Introduction Two’s complement signed integer is an efficient representation for integers Two’s complement signed integer, however, can not: - Handle fractions - Handle huge numbers (#’s > 2(N-1)-1 for a N-bit 2’s complement integers) (Astronomy needs those huge numbers) - Handle really small numbers (#’s < -2(N-1) for a N-bit 2’s complement integers) (Physics needs those small numbers) Used for fractions in most of the computers Fixed-point notations Floating-point notations Can handle fractions Fractions used in computers Can’t handle huge and small numbers Can handle fractions Can handle huge and small numbers IEEE754/002

CS 286 Computer Architecture & Organization Fixed-point notations The decimal point is fixed at a certain bit position 16 bits LSB MSB Sign Bit 1 1 Integer bits Fraction bits  0 = positive 1 = negative MSB LSB 1 2-1 2-2 2-3 2-4 2-5 2-6 2-7 2-8 (1/2) (1/4) (1/8) (1/16) (1/32) (1/64) (1/128) (1/256) = 1/4 + 1/8 + 1/32 + 1/128 IEEE754/003

CS 286 Computer Architecture & Organization Fixed-point notations The decimal point is fixed at a certain bit position 16 bits LSB MSB 1 1 Sign Bit  Not quite large  Approximately +128 0 = positive 1 = negative Integer bits Fraction bits Is this really a large #? The largest number: The smallest number: LSB MSB 1 1 Approximately -128 Is this really a small #? Not quite small  LSB MSB 1 1 1 IEEE754/004

CS 286 Computer Architecture & Organization Exponent Floating-point notations General Implementation Format  S  10( E) Sign 976,000,000,000,000 = 9.76  1014 + 9.76  10(+ 14)   Integer  Fraction  Decimal-point locator Signficand (Mantissa) Move . to the right by one position = 0.00976  1017 Decrease the exponent by one All the same value = 97.6  1013 Move . to the left by one position = 0.976  1015 Increase the exponent by one = 976000000000000.0  100 Why is this notation efficient?  Can handle fractions YES  Can handle huge numbers (by having a large positive exponent)  Can handle tiny numbers or really small number IEEE754/005 (0.000000000016) (-1230000000000000000)

CS 286 Computer Architecture & Organization Binary implementation of floating-point numbers This is how computers implement floating-point numbers inside of a computer General Implementation Format  S  2( E) Sign Exponent  0.1101  2(101011) Signficand (Mantissa) Only 0 and 1 (binary numbers) Examples The following representations are all the same in value +11000 (“24“ in decimal) = +11000  20 All same value +0.11  25 +0.0011  27 +11000000  2(-3) IEEE754/006

CS 286 Computer Architecture & Organization IEEE 754 Floating-Point Standard The standard most of the processors today use 32 bits Sign Bit 0 = positive 1 = negative LSB MSB     Biased Exponent (8) (a bias of 127) Significand (23) -127127 IEEE-754 Floating-Point Standard uses “Bias of 127” Bit patterns for a 8-bit numbers Decimals 255 128 -127    Bias of 0 Bias of 127 Bias of 2    11111111 N. A. N. A.    N. A. 11111111 10000000 11111111 10000010    01111111       00000000 00000010 N. A. 00000000 N. A. 00000000 N. A. IEEE754/007

CS 286 Computer Architecture & Organization IEEE 754 Floating-Point Standard The standard most of the processors today use 32 bits Sign Bit 0 = positive 1 = negative LSB MSB     Biased Exponent (8) (a bias of 127) Significand (23) -127128 More than one digit above the decimal point! Example for “significand” 18.5(10) = 16(10)+2(10)+0.5(10) = 10010.1 (2) = 10010.1 (2)  20 this format is NOT acceptable Make sure that we have only one digit above the decimal point = 1.00101 (2)  24 = 0.100101 (2)  25 = 0.0100101 (2)  26 IEEE754/008

CS 286 Computer Architecture & Organization Three Exceptions in “Exponent Bit” Decimals 255 128 -127    11111111 10000000 00000000 N. A. Bias of 0 Bias of 2 00000010 01111111 10000010 Bias of 127  The pattern of all 1’s (for “128”) is NOT used The Max. exponent is 127 - They are used for the infinity and specific error codes  The pattern of all 0’s (“-127”) is NOT used The Min. exponent is -126  The pattern of all 0’s (“-127”) with all 0’s in the significand bits is reserved for “0.0000000000” IEEE754/009

CS 286 Computer Architecture & Organization Three Exceptions in “Exponent Bit”  The pattern of all 0’s (“-127”) with all 0’s in the significand bits is reserved for “0.0000000000” This means “0.0000 … 00” 32 bits LSB MSB Sign Bit     Significand (23) Biased Exponent (8) IEEE754/010

CS 286 Computer Architecture & Organization Examples +0.110  25 LSB MSB 32 bits Significand (23) Biased Exponent (8)    (a bias of 127) Sign Bit 1 1 0 = positive 1 = negative Decimals 255 128 -127    11111111 10000000 00000000 N. A. Bias of 0 Bias of 127 01111111 Exponent “5” in bias of 127 0: 0111 1111 + 5: 0000 0101 1 IEEE754/011

CS 286 Computer Architecture & Organization Normalized Notation Always align the first left-most “1” in the signifcand at the first digit above the decimal point Always “1.” appear Normalized Unnormalized +0.110  25 +0.0101  281 +101000.10  2-8 +0.000010  2-2 +1.1  24 +1.01  279 +1.010001  2-3 Why normalized notation? +1  2-7 IEEE754/012

CS 286 Computer Architecture & Organization Normalized Notation Always align the first left-most “1” in the signifcand at the first digit above the decimal point For any normalized floating-point number, this bit is ALWAYS “1” Examples +1.10  24 LSB MSB 32 bits Sign Bit Significand (23) Biased Exponent (8) 0 = positive 1 = negative    (a bias of 127) 1 1 1 LSB MSB    1 1 LSB MSB    1 You got one more significand bit! IEEE754/013

CS 286 Computer Architecture & Organization Format of typical floating-point notations 32 bits MSB     LSB Sign Bit 0 = positive 1 = negative Biased Exponent (8) Significand (23) (a bias of 127) -126127 Smallest Negative Largest Negative Smallest Positive Largest Positive Larger Smaller Negative Positive IEEE754/014

CS 286 Computer Architecture & Organization Format of typical floating-point notations 32 bits MSB     LSB Sign Bit 0 = positive 1 = negative Biased Exponent (8) Significand (23) (a bias of 127) -126127 BE = -126 Significand = all 0 Sign = 1 BE = 127 Significand = all “1” Sign = 0 Smallest Negative Largest Negative Smallest Positive Largest Positive Negative Positive BE = 127 Significand = all “1” Sign = 1 BE = -126 Significand = all 0 Sign = 0 IEEE754/015

CS 286 Computer Architecture & Organization Format of typical floating-point notations 32 bits MSB     LSB Sign Bit 0 = positive 1 = negative Biased Exponent (8) Significand (23) (a bias of 127) -126127 BE = -126 Significand = all “0” Sign = 1 BE = 127 Significand = all “1” Sign = 0 Negative Positive Negative Underflow Negative Overflow BE = 127 Significand = all “1” Sign = 1 Positive Underflow BE = -126 Significand = all “0” Sign = 0 Positive Overflow IEEE754/016

CS 286 Computer Architecture & Organization Format of typical floating-point notations 32 bits MSB     LSB Sign Bit 0 = positive 1 = negative Biased Exponent (8) Significand (23) (a bias of 127) -126127 2(-148) Negative Positive 2(104) 2(104) 2(-148) IEEE754/017

CS 286 Computer Architecture & Organization Format of typical floating-point notations 32 bits MSB     LSB Sign Bit 0 = positive 1 = negative Biased Exponent (8) Significand (23) (a bias of 127) -126127 We got high accuracy For tiny numbers Negative Positive We can represent huge numbers We lost accuracy We lost accuracy IEEE754/018

CS 286 Computer Architecture & Organization IEEE-754 Floating-Point Notations  Single-Float  Double-Float (single-precision floating-point) – “float” in C/C++ 32 bits LSB MSB Sign Bit Significand (23) Biased Exponent (8) 0 = positive 1 = negative     (a bias of 127) -126127 (double-precision floating-point) – “double” in C/C+ 64 bits LSB MSB Sign Bit 0 = positive 1 = negative     Biased Exponent (11) Significand (52) IEEE754/019

CS 286 Computer Architecture & Organization IEEE754/000