Integer & Floating Point Representations CDA 3101 Discussion Session 05.

Slides:



Advertisements
Similar presentations
Arithmetic in Computers Chapter 4 Arithmetic in Computers2 Outline Data representation integers Unsigned integers Signed integers Floating-points.
Advertisements

Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3: IT Students.
Floating Point Numbers. CMPE12cGabriel Hugh Elkaim 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or.
Floating Point Numbers. CMPE12cCyrus Bazeghi 2 Floating Point Numbers Registers for real numbers usually contain 32 or 64 bits, allowing 2 32 or 2 64.
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.
1 Lecture 3 Bit Operations Floating Point – 32 bits or 64 bits 1.
Integer Arithmetic Floating Point Representation Floating Point Arithmetic Topics.
1 Module 2: Floating-Point Representation. 2 Floating Point Numbers ■ Significant x base exponent ■ Example:
Quiz 1.1 Convert the following unsigned binary numbers to their decimal equivalent: Number2 Number
Binary Representation and Computer Arithmetic
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.
Computer Arithmetic Nizamettin AYDIN
NUMBER REPRESENTATION CHAPTER 3 – part 3. ONE’S COMPLEMENT REPRESENTATION CHAPTER 3 – part 3.
Computer Architecture
S. Rawat I.I.T. Kanpur. Floating-point representation IEEE numbers are stored using a kind of scientific notation. ± mantissa * 2 exponent We can represent.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
9.4 FLOATING-POINT REPRESENTATION
Floating Point Representations CDA 3101 Discussion Session 02.
Chapter 3 Number Representation. Convert a number from decimal to binary notation and vice versa. Understand the different representations of an integer.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
1 Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 3:
Floating Point Arithmetic
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Number Systems & Operations
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Computing Machinery Chapter 6: Computer Arithmetic.
CEC 220 Digital Circuit Design Binary Codes
IT11004: Data Representation and Organization Floating Point Representation.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
©Brooks/Cole, 2003 Chapter 3 Number Representation.
In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative The same is true for binary numbers a computer.
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.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Fundamentals of Computer Science
A brief comparison of integer and double representation
Negative Binary Numbers
Introduction To Computer Science
Floating Point Representations
Computer Science 210 Computer Organization
Floating Point Number system corresponding to the decimal notation
Negative Binary Numbers
ECE 103 Engineering Programming Chapter 3 Numbers
William Stallings Computer Organization and Architecture 7th Edition
Computer Science 210 Computer Organization
Number Representations
Data Representation in Computer Systems
ECEG-3202 Computer Architecture and Organization
Number Representation
Chapter 8 Computer Arithmetic
Chapter 6: Computer Arithmetic
Numbers representations
OBJECTIVES After reading this chapter, the reader should be able to :
Number Representations
Presentation transcript:

Integer & Floating Point Representations CDA 3101 Discussion Session 05

Question 1 Converting into a 32-bit sign magnitude. Step 1: magnitude - converting 4047 to binary Step 2: Sign Inverting the MSB (sign bit)

Question 1 cont. Converting into a 32-bit 1 ’ s complement. Step 1: converting 4047 to binary Step 2: 1 ’ s complement: (unsigned)(X + x) = Inverting all the bits Check if (X+x) = ?

Question 1 cont. Converting into a 32-bit 2 ’ s complement. Step 1: converting 4047 to binary Step 2: 2 ’ s complement: (unsigned)(X + x) = Inverting all the bits (1 ’ s complement) Adding Check (X+x) = 2 n ?

Question 2 Converting the binary number to decimal, if the binary is Unsigned? 2 ’ s complement? Single precision floating-point?

Question 2.1 Converting bin (unsigned) to dec * * … + 1* * *2 2 =

Question 2.2 Converting bin (2 ’ s complement) to dec * * … + 1* * *2 2 =

Question 2.3 Converting bin (Single precision FP) to dec Sign bit : 1 Exponent : = 73 Fraction : =1* * … + 1* * *2 -21 = (-1) S * (1.Fraction) * 2 (Exponent - 127) = (-1) 1 * ( ) * 2 ( ) = * = * S(1)Biased Exponent(8)Fraction (23)

Question 3 Show the IEEE 754 binary representation for the floating-point number in single ­ precision.

Question 3.1 Converting to single-precision FP Step1: Covert fraction 0.1 to binary (multiplying by 2) 0.1*2 = 0.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, 0.2*2 = 0.4, 0.4*2 = 0.8, 0.8*2 = 1.6, 0.6*2 = 1.2, … … … * 2 -4 Step2: Express in single precision format (-1) S * (1.Fraction) * 2 (Exponent +127) = (-1) 0 * ( ) * 2 (-4+127)

Overflow Example 4-bit signed ALU Signed Value Range [-8,7] The MSB is signed bit = 0111 –3+4 =7 –Positive + Positive = Positive = 1001 –4 +5 =-7 (the signed bit is 1) –Overflow

Overflow or Not? = = = =

Overflow or Not? = – (-3)+(-5) =(-8) = – (-7) + (-3) = 6 OVERFLOW! = – (-6) –(3) = 7 OVERFLOW! = – (4) –(-4) =( -8) OVERFLOW!

Any More Questions?