Number Systems II Prepared by Dr P Marais (Modified by D Burford)

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.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Lecture 16: Computer Arithmetic Today’s topic –Floating point numbers –IEEE 754 representations –FP arithmetic Reminder –HW 4 due Monday 1.
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
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)
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.
Number Systems Standard positional representation of numbers:
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
CSE 378 Floating-point1 How to represent real numbers In decimal scientific notation –sign –fraction –base (i.e., 10) to some power Most of the time, usual.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Floating Point Numbers
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)
IEEE Floating Point Numbers Overview Noah Mendelsohn Tufts University Web: COMP.
Simple Data Type Representation and conversion of numbers
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Number Systems and Logic UCT Dept of Computer Science CSC
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
Fixed-Point Arithmetics: Part II
ECE232: Hardware Organization and Design
Floating Point Numbers Topics –IEEE Floating Point Standard –Rounding –Floating Point Operations –Mathematical properties.
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
Fixed and Floating Point Numbers Lesson 3 Ioan Despi.
CSC 221 Computer Organization and Assembly Language
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Conversion to Larger Number of Bits Ex: Immediate Field (signed 16 bit) to 32 bit Positive numbers have implied 0’s to the left. So, put 16 bit number.
Number Systems and Logic UCT Dept of Computer Science CS115 ~ 2003.
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
10/7/2004Comp 120 Fall October 7 Read 5.1 through 5.3 Register! Questions? Chapter 4 – Floating Point.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
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.
Chapter 9 Computer Arithmetic
Floating Point Representations
2.4. Floating Point Numbers
Integer Division.
Lecture 9: Floating Point
Floating Point Numbers: x 10-18
Floating Point Number system corresponding to the decimal notation
CS 232: Computer Architecture II
Topic 3d Representation of Real Numbers
Number Representations
CSCI206 - Computer Organization & Programming
How to represent real numbers
How to represent real numbers
ECEG-3202 Computer Architecture and Organization
Topic 3d Representation of Real Numbers
CS 286 Computer Architecture & Organization
Chapter3 Fixed Point Representation
Numbers with fractions Could be done in pure binary
Number Representations
Presentation transcript:

Number Systems II Prepared by Dr P Marais (Modified by D Burford)

Floating point Numbers Fixed point numbers have very limited range (determined by bit length) 32-bit value can hold integers from to or smaller range of fixed point fractional values Solution: use floating point (scientific notation) Thus  9.76*10 -14

Floating point Numbers Consists of two parts: mantissa & exponent –Mantissa: the number multiplying the base –Exponent: the power The significand is the part of the mantissa after the decimal point

Floating point Numbers * exponent -14 mantissa 9.76 significand 0.76

Floating point Numbers Range is very large Accuracy limited by significand So, for 8 digits of precision, = *10 11 and we loose accuracy (truncation error)

Floating point Numbers Can normalise any floating point number: 34.34*10 12 = 3.434*10 13 Shift point until only one non-zero digit is to left –add 1 to exponent for each left shift –subtract 1 for each right shift

Floating point Numbers Can use notation for binary (base of 2!!) *2 -3 = *2 -4 = * (2's complement exponent) For binary FP numbers, normalise to: 1.xxx…xxx*2 yy…yy

Floating point Numbers Problems with FP: –Many different floating point formats; problems exchanging data –FP arithmetic not associative: x + (y + z) != (x + y) + z IEEE 754 format introduced: –single (32-bit) –double (64-bit)

Floating point Numbers Single precsion number represented internally as –1 sign-bit –exponent (8-bits) –significand (fractional part of normalised number) (23 bits) The leading 1 of mantissa is implied; not stored

Floating point Numbers Double precision – 1 sign-bit – 11 bit exponent – 52 bit significand

Floating point Numbers The exponent is “biased‘”: no explicit negative number Single precision: 127, Double precision 1023 So, for single prec: –If exponent is 128, represent as = 255 –If exponent is –127, represent as = 0 –Can't be symmetric, because of zero

Floating point Numbers Most positive exponent: , most negative: 00.…000 Makes some hardware/logic easier for exponents (easy sorting/compare) numeric value of stored IEEE FP is actually: (-1) S * (1 + significand) * 2 exponent - bias

Example: to IEEE754 Single Sign is negative: so S = 1 Binary fraction: 0.75*2 = 1.5 (IntPart = 1) 0.50*2 = 1.0 (IntPart = 1), so = Normalise: 0.11*2 0 = 1.1*2 -1 Exponent: -1, add bias of 127 = 126 = Answer: [1] [ ] [100… ] s 8 bits 23 bits

What is the value of this FP num? [1] [ ] [ ]

What is the value of this FP num? [1] [ ] [ ] 1.Negative number (S=1) 2.Biased exponent: = = 129 Unbiased exponent = = 2 3.Significand: = = Value = (-1) * ( )*2 2 =

Floating point Numbers IEEE 754 has special codes for zero, errors –Zero: exp and significand are zero –Infinity: exp = , significand = 0 –NaN (not a number eg. 0/0): exp = , significand != 0

Range of floating point –Single precision range: to ( )*2 127 –Approx. 2* to 2*10 38 –Double range: to ( )* –Approx. 2* to 2*10 308

Floating point Numbers Addition/Subtraction: normalise, match to larger exponent then add, normalise again Underflow/overflow conditions : –Exponent Overflow Exponent bigger than max permissable size; may be set to “infinity”' –Exponent Underflow Neg exponent, smaller than minimum size; may be set to zero –Significand Underflow Alignment may causes loss of significant digits –Significand Overflow Addition may cause carry overflow; realign significands