CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Size: px
Start display at page:

Download "CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng."

Transcription

1 CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. 1

2 Part 1: Data Representation Our goal: revisit and re-establish fundamental of mathematics for the computer architecture course Overview: what are bits & bytes? bit and arithmetic value? bit and hexadecimal? character set in PCs? how to do binary arithmetic operation (+,-,*,/)? integer representation in PCs: signed and unsigned binary and floating point floating point representation? order of byte in computers big endian vs. little endian 2

3 Conversion in Between Float and Binary 3

4 Floating point means a number with an integral part and a fractional part Converting floating point in between decimal and binary Place values: Floating point Integral part Fractional part Example: 4.5 (decimal) = (binary) 4

5 Converting floating point Example: 6.25 = Method: 6 = x 2 = x 2 = 1.0 (Stop when fractional part is 0) Example: (Integral part: convert in the usual way).5 (Fractional part: successive multiplication by 2) 6 = x 2 = x 2 = x 2 = x 2 = x 2 = 0.4 (repeats)

6 One more example to convert floating point Example: 6.4? How the floating binary number stored in computer? 6

7 How Float Represented in Computer 7

8 Floating point representation in computer Computers use a form of scientific notation for floatingpoint representation Numbers written in scientific notation have three basic components: Example: x use base 2 instead of base 10 Sign Mantissa Exponent Exponent specifies the order of magnitude in a base Mantissa specifies most significant part of value Sign specifies negative or positive 8

9 Floating point representation in computer Computer representation of a floating-point number consists of three fixed-size fields: This is the standard arrangement of these fields. 9

10 Floating point representation in computer (1) The one-bit sign field is the sign of the stored value. (2) The size of the exponent field, determines the range of values that can be represented. (3) The size of the significand determines the precision of the representation. 10

11 Floating point representation in computer single-precision (32 bits) floating point representation defined by IEEE standard sign bit "biased" exponent (8 bits) "normalized" mantissa (23 bits) Floating point = (-1) s x (1.m) x 2 (e-bias) Notice that the 1 in 1.m is always assumed. where, bias =

12 Floating point representation in computer double-precision (64 bits) floating point representation defined by IEEE standard sign bit "biased" exponent (11 bits) "normalized" mantissa (52 bits) Floating point = (-1) s x (1.m) x 2 (e-bias) where, bias =

13 Floating point representation: example 1 Given decimal real number 6.25, what is its single precision floating number stored in PC? Step (decimal) = (binary) Step 2. Move the radix point until a single 1 appears on the left, and multiply by the corresponding power of x2 2 so the sign bit is 0 (positive) the biased exponent is = 129 = = e and the normalized mantissa is 1001 (drop the 1, rest zero-fill) C80000 hexadecimal 13

14 Floating point representation: example 2 Given decimal real number 6.2, what is its single precision floating number stored in PC? Step (decimal) = (binary) Step 2. Move the radix point until a single 1 appears on the left, and multiply by the corresponding power of 2 = x2 2 so the sign bit is 0 (positive) the biased exponent is = 129= and the normalized mantissa is C66666 hexadecimal 14

15 Floating point representation: example 3 Double value in memory (in hex): what s its binary: what s its decimal? s (bit 64) = 0 = positive number e (bits 52 to 62) = = = 1026 m (bits 0 to 51) = Value = (-1) 0 x (1.01) b x 2 ( ) = 1x ( )x2 3 =(1+1/4)x8=8+2=10 15

16 Floating point representation: example 4 What decimal floating-point number is represented by 0xC ? Sign Biased exponent Normalized mantissa so the sign is negative the unbiased exponent is = 4 and the unnormalized mantissa is (add the 1 left of the radix point). Move the radix point 4 places to the right: =

17 Byte Order: Big Endian vs. Little Endian 17

18 Byte order Byte ordering, or endianness, is a major computer architectural consideration Byte ordering describes how data stored in memory, which is visible and important to programmer More details later in the course, here we introduce basic concept 18

19 Byte order If we have a two-byte integer, the integer may be stored so that the least significant byte is followed by the most significant byte or vice versa. In little endian machines, the least significant byte is stored in lowest memory location. (DEC, IBM (Intel Pentium)) Big endian machines store the most significant byte in lowest memory. (Motorola, Sun SPARC) 19

20 Big and little endian: an example Given 32 bits (4 bytes) integer (or single-precision floating point numbers) 0x 90AB12CD, the 4 bytes are: 90, AB, 12, CD, How can we store these values into memory? Big Endian In big endian, we store the most significant byte in the smallest address. Here's how it would look: Little Endian In little endian, we store the least significant byte in the smallest address. Here's how it would look: Address Value AB CD Address Value 1000 CD AB

21 Endianness: consequence for programmer For JAVA programmer, we have to know: - Everything in Java binary format files is stored big-endian, i.e. MSB (Most Significant Byte) first. - JAVA is platform independent because and Java hides internal endianness from us no matter what internal byte order used (i.e. Mac is big-endian order and intel PC is little-endian) For C programmer, we have to know: - Most files compiled by C use little-endian in windows PC For both C and JAVA programmer, we have to fix the byte order problem when transferring data files between computers for which the byte ordering differs 21

22 Summary: conceptual issues Bits grouped into sets to represent Integers Characters Floating point values Signed integers can be represented as Sign magnitude One's complement Two's complement Bytes of integer can be numbered in Big-endian order and Little-endian order 22

23 Summary: technical issues Conversion in between Binary, Hexadecimal, Decimal, Single Float and Double Signed Integer represented by Sign magnitude One's complement Two's complement The consequence of byte order to our programmers 23

24 Thank you for your attendance Any questions? 24

Floating Point Arithmetic

Floating Point Arithmetic Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678

More information

IEEE-754 floating-point

IEEE-754 floating-point IEEE-754 floating-point Real and floating-point numbers Real numbers R form a continuum - Rational numbers are a subset of the reals - Some numbers are irrational, e.g. π Floating-point numbers are an

More information

Numeric Encodings Prof. James L. Frankel Harvard University

Numeric Encodings Prof. James L. Frankel Harvard University Numeric Encodings Prof. James L. Frankel Harvard University Version of 10:19 PM 12-Sep-2017 Copyright 2017, 2016 James L. Frankel. All rights reserved. Representation of Positive & Negative Integral and

More information

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column 1's column 10's column 100's column 1000's column 1's column 2's column 4's column 8's column Number Systems Decimal numbers 5374 10 = Binary numbers 1101 2 = Chapter 1 1's column 10's column 100's

More information

COMP2611: Computer Organization. Data Representation

COMP2611: Computer Organization. Data Representation COMP2611: Computer Organization Comp2611 Fall 2015 2 1. Binary numbers and 2 s Complement Numbers 3 Bits: are the basis for binary number representation in digital computers What you will learn here: How

More information

MACHINE LEVEL REPRESENTATION OF DATA

MACHINE LEVEL REPRESENTATION OF DATA MACHINE LEVEL REPRESENTATION OF DATA CHAPTER 2 1 Objectives Understand how integers and fractional numbers are represented in binary Explore the relationship between decimal number system and number systems

More information

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right. Floating-point Arithmetic Reading: pp. 312-328 Floating-Point Representation Non-scientific floating point numbers: A non-integer can be represented as: 2 4 2 3 2 2 2 1 2 0.2-1 2-2 2-3 2-4 where you sum

More information

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK Computer (Literacy Skills Number representations and memory Lubomír Bulej KDSS MFF UK Number representations? What for? Recall: computer works with binary numbers Groups of zeroes and ones 8 bits (byte,

More information

IEEE Standard for Floating-Point Arithmetic: 754

IEEE Standard for Floating-Point Arithmetic: 754 IEEE Standard for Floating-Point Arithmetic: 754 G.E. Antoniou G.E. Antoniou () IEEE Standard for Floating-Point Arithmetic: 754 1 / 34 Floating Point Standard: IEEE 754 1985/2008 Established in 1985 (2008)

More information

COMP2121: Microprocessors and Interfacing. Number Systems

COMP2121: Microprocessors and Interfacing. Number Systems COMP2121: Microprocessors and Interfacing Number Systems http://www.cse.unsw.edu.au/~cs2121 Lecturer: Hui Wu Session 2, 2017 1 1 Overview Positional notation Decimal, hexadecimal, octal and binary Converting

More information

Number Representations

Number Representations Number Representations times XVII LIX CLXX -XVII D(CCL)LL DCCC LLLL X-X X-VII = DCCC CC III = MIII X-VII = VIIIII-VII = III 1/25/02 Memory Organization Viewed as a large, single-dimension array, with an

More information

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit Announcements Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit Quiz 2 Monday on Number System Conversions

More information

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng. CS 265 Computer Architecture Wei Lu, Ph.D., P.Eng. CS 265 Midterm #1 Monday, Oct 18, 12:00pm-1:45pm, SCI 163 Questions on essential terms and concepts of Computer Architecture Mathematical questions on

More information

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation Data Representation II CMSC 313 Sections 01, 02 The conversions we have so far presented have involved only unsigned numbers. To represent signed integers, computer systems allocate the high-order bit

More information

Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states).

Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states). Representing numbers on the computer. Computer memory/processors consist of items that exist in one of two possible states (binary states). These states are usually labeled 0 and 1. Each item in memory

More information

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example Appendix F Number Systems Binary Numbers Decimal notation represents numbers as powers of 10, for example 1729 1 103 7 102 2 101 9 100 decimal = + + + There is no particular reason for the choice of 10,

More information

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-1 CHAPTER V CHAPTER V NUMBER SYSTEMS AND ARITHMETIC CHAPTER V-2 NUMBER SYSTEMS RADIX-R REPRESENTATION Decimal number expansion 73625 10 = ( 7 10 4 ) + ( 3 10 3 ) + ( 6 10 2 ) + ( 2 10 1 ) +(

More information

Module 2: Computer Arithmetic

Module 2: Computer Arithmetic Module 2: Computer Arithmetic 1 B O O K : C O M P U T E R O R G A N I Z A T I O N A N D D E S I G N, 3 E D, D A V I D L. P A T T E R S O N A N D J O H N L. H A N N E S S Y, M O R G A N K A U F M A N N

More information

CHW 261: Logic Design

CHW 261: Logic Design CHW 261: Logic Design Instructors: Prof. Hala Zayed Dr. Ahmed Shalaby http://www.bu.edu.eg/staff/halazayed14 http://bu.edu.eg/staff/ahmedshalaby14# Slide 1 Slide 2 Slide 3 Digital Fundamentals CHAPTER

More information

Inf2C - Computer Systems Lecture 2 Data Representation

Inf2C - Computer Systems Lecture 2 Data Representation Inf2C - Computer Systems Lecture 2 Data Representation Boris Grot School of Informatics University of Edinburgh Last lecture Moore s law Types of computer systems Computer components Computer system stack

More information

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers Chapter 03: Computer Arithmetic Lesson 09: Arithmetic using floating point numbers Objective To understand arithmetic operations in case of floating point numbers 2 Multiplication of Floating Point Numbers

More information

M1 Computers and Data

M1 Computers and Data M1 Computers and Data Module Outline Architecture vs. Organization. Computer system and its submodules. Concept of frequency. Processor performance equation. Representation of information characters, signed

More information

Introduction to Computers and Programming. Numeric Values

Introduction to Computers and Programming. Numeric Values Introduction to Computers and Programming Prof. I. K. Lundqvist Lecture 5 Reading: B pp. 47-71 Sept 1 003 Numeric Values Storing the value of 5 10 using ASCII: 00110010 00110101 Binary notation: 00000000

More information

UNIT 7A Data Representation: Numbers and Text. Digital Data

UNIT 7A Data Representation: Numbers and Text. Digital Data UNIT 7A Data Representation: Numbers and Text 1 Digital Data 10010101011110101010110101001110 What does this binary sequence represent? It could be: an integer a floating point number text encoded with

More information

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers

l l l l l l l Base 2; each digit is 0 or 1 l Each bit in place i has value 2 i l Binary representation is used in computers 198:211 Computer Architecture Topics: Lecture 8 (W5) Fall 2012 Data representation 2.1 and 2.2 of the book Floating point 2.4 of the book Computer Architecture What do computers do? Manipulate stored information

More information

Number Systems. Both numbers are positive

Number Systems. Both numbers are positive Number Systems Range of Numbers and Overflow When arithmetic operation such as Addition, Subtraction, Multiplication and Division are performed on numbers the results generated may exceed the range of

More information

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: N Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as: a n a a a The value of this number is given by: = a n Ka a a a a a

More information

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1 IT 1204 Section 2.0 Data Representation and Arithmetic 2009, University of Colombo School of Computing 1 What is Analog and Digital The interpretation of an analog signal would correspond to a signal whose

More information

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr Number Systems and Binary Arithmetic Quantitative Analysis II Professor Bob Orr Introduction to Numbering Systems We are all familiar with the decimal number system (Base 10). Some other number systems

More information

Chapter 2. Data Representation in Computer Systems

Chapter 2. Data Representation in Computer Systems Chapter 2 Data Representation in Computer Systems Chapter 2 Objectives Understand the fundamentals of numerical data representation and manipulation in digital computers. Master the skill of converting

More information

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3 Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part

More information

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI. CSCI 402: Computer Architectures Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI 3.5 Today s Contents Floating point numbers: 2.5, 10.1, 100.2, etc.. How

More information

COMP Overview of Tutorial #2

COMP Overview of Tutorial #2 COMP 1402 Winter 2008 Tutorial #2 Overview of Tutorial #2 Number representation basics Binary conversions Octal conversions Hexadecimal conversions Signed numbers (signed magnitude, one s and two s complement,

More information

Chapter Three. Arithmetic

Chapter Three. Arithmetic Chapter Three 1 Arithmetic Where we've been: Performance (seconds, cycles, instructions) Abstractions: Instruction Set Architecture Assembly Language and Machine Language What's up ahead: Implementing

More information

Number System. Introduction. Decimal Numbers

Number System. Introduction. Decimal Numbers Number System Introduction Number systems provide the basis for all operations in information processing systems. In a number system the information is divided into a group of symbols; for example, 26

More information

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM

1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1. NUMBER SYSTEMS USED IN COMPUTING: THE BINARY NUMBER SYSTEM 1.1 Introduction Given that digital logic and memory devices are based on two electrical states (on and off), it is natural to use a number

More information

Chapter 3: Arithmetic for Computers

Chapter 3: Arithmetic for Computers Chapter 3: Arithmetic for Computers Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point Computer Architecture CS 35101-002 2 The Binary Numbering

More information

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation

Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur Number Representation Number Systems Prof. Indranil Sen Gupta Dept. of Computer Science & Engg. Indian Institute of Technology Kharagpur 1 Number Representation 2 1 Topics to be Discussed How are numeric data items actually

More information

Organisasi Sistem Komputer

Organisasi Sistem Komputer LOGO Organisasi Sistem Komputer OSK 8 Aritmatika Komputer 1 1 PT. Elektronika FT UNY Does the calculations Arithmetic & Logic Unit Everything else in the computer is there to service this unit Handles

More information

ECE331: Hardware Organization and Design

ECE331: Hardware Organization and Design ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5

More information

ECE232: Hardware Organization and Design

ECE232: Hardware Organization and Design ECE232: Hardware Organization and Design Lecture 11: Floating Point & Floating Point Addition Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Last time: Single Precision Format

More information

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal

Basic Definition INTEGER DATA. Unsigned Binary and Binary-Coded Decimal. BCD: Binary-Coded Decimal Basic Definition REPRESENTING INTEGER DATA Englander Ch. 4 An integer is a number which has no fractional part. Examples: -2022-213 0 1 514 323434565232 Unsigned and -Coded Decimal BCD: -Coded Decimal

More information

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays

ECE 372 Microcontroller Design Assembly Programming Arrays. ECE 372 Microcontroller Design Assembly Programming Arrays Assembly Programming Arrays Assembly Programming Arrays Array For Loop Example: unsigned short a[]; for(j=; j

More information

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. ! Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating

More information

Introduction to Scientific Computing Lecture 1

Introduction to Scientific Computing Lecture 1 Introduction to Scientific Computing Lecture 1 Professor Hanno Rein Last updated: September 10, 2017 1 Number Representations In this lecture, we will cover two concept that are important to understand

More information

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,...

Groups of two-state devices are used to represent data in a computer. In general, we say the states are either: high/low, on/off, 1/0,... Chapter 9 Computer Arithmetic Reading: Section 9.1 on pp. 290-296 Computer Representation of Data Groups of two-state devices are used to represent data in a computer. In general, we say the states are

More information

Number Systems CHAPTER Positional Number Systems

Number Systems CHAPTER Positional Number Systems CHAPTER 2 Number Systems Inside computers, information is encoded as patterns of bits because it is easy to construct electronic circuits that exhibit the two alternative states, 0 and 1. The meaning of

More information

Final Labs and Tutors

Final Labs and Tutors ICT106 Fundamentals of Computer Systems - Topic 2 REPRESENTATION AND STORAGE OF INFORMATION Reading: Linux Assembly Programming Language, Ch 2.4-2.9 and 3.6-3.8 Final Labs and Tutors Venue and time South

More information

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 4-A Floating-Point Arithmetic Israel Koren ECE666/Koren Part.4a.1 Preliminaries - Representation

More information

15213 Recitation 2: Floating Point

15213 Recitation 2: Floating Point 15213 Recitation 2: Floating Point 1 Introduction This handout will introduce and test your knowledge of the floating point representation of real numbers, as defined by the IEEE standard. This information

More information

Basic data types. Building blocks of computation

Basic data types. Building blocks of computation Basic data types Building blocks of computation Goals By the end of this lesson you will be able to: Understand the commonly used basic data types of C++ including Characters Integers Floating-point values

More information

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

10.1. Unit 10. Signed Representation Systems Binary Arithmetic 0. Unit 0 Signed Representation Systems Binary Arithmetic 0.2 BINARY REPRESENTATION SYSTEMS REVIEW 0.3 Interpreting Binary Strings Given a string of s and 0 s, you need to know the representation system

More information

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture) COSC 243 Data Representation 3 Lecture 3 - Data Representation 3 1 Data Representation Test Material Lectures 1, 2, and 3 Tutorials 1b, 2a, and 2b During Tutorial a Next Week 12 th and 13 th March If you

More information

3.5 Floating Point: Overview

3.5 Floating Point: Overview 3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer

More information

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University. Data Representation ti and Arithmetic for Computers Rui Wang, Assistant professor Dept. of Information and Communication Tongji University it Email: ruiwang@tongji.edu.cn Questions What do you know about

More information

CS 101: Computer Programming and Utilization

CS 101: Computer Programming and Utilization CS 101: Computer Programming and Utilization Jul-Nov 2017 Umesh Bellur (cs101@cse.iitb.ac.in) Lecture 3: Number Representa.ons Representing Numbers Digital Circuits can store and manipulate 0 s and 1 s.

More information

Digital Fundamentals

Digital Fundamentals Digital Fundamentals Tenth Edition Floyd Chapter 2 2009 Pearson Education, Upper 2008 Pearson Saddle River, Education NJ 07458. All Rights Reserved Decimal Numbers The position of each digit in a weighted

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 3. L12 Multiplication 1 Approximating Real Numbers on Computers Thus far, we ve entirely ignored one of the most

More information

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j

±M R ±E, S M CHARACTERISTIC MANTISSA 1 k j ENEE 350 c C. B. Silio, Jan., 2010 FLOATING POINT REPRESENTATIONS It is assumed that the student is familiar with the discussion in Appendix B of the text by A. Tanenbaum, Structured Computer Organization,

More information

Numerical computing. How computers store real numbers and the problems that result

Numerical computing. How computers store real numbers and the problems that result Numerical computing How computers store real numbers and the problems that result The scientific method Theory: Mathematical equations provide a description or model Experiment Inference from data Test

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 4. L12 Multiplication 1 Why Floating Point? Aren t Integers enough? Many applications require numbers with a VERY

More information

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Signed Multiplication Multiply the positives Negate result if signs of operand are different Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication Signed Multiplication Multiply the positives Negate result

More information

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754 Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that

More information

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties

More information

The type of all data used in a C++ program must be specified

The type of all data used in a C++ program must be specified The type of all data used in a C++ program must be specified A data type is a description of the data being represented That is, a set of possible values and a set of operations on those values There are

More information

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction 1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in

More information

Divide: Paper & Pencil

Divide: Paper & Pencil Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or

More information

In this lesson you will learn: how to add and multiply positive binary integers how to work with signed binary numbers using two s complement how fixed and floating point numbers are used to represent

More information

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers. class04.ppt 15-213 The course that gives CMU its Zip! Topics Floating Point Jan 22, 2004 IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Floating Point Puzzles For

More information

Representing and Manipulating Floating Points. Jo, Heeseung

Representing and Manipulating Floating Points. Jo, Heeseung Representing and Manipulating Floating Points Jo, Heeseung The Problem How to represent fractional values with finite number of bits? 0.1 0.612 3.14159265358979323846264338327950288... 2 Fractional Binary

More information

INTEGER REPRESENTATIONS

INTEGER REPRESENTATIONS INTEGER REPRESENTATIONS Unsigned Representation (B2U). Two s Complement (B2T). Signed Magnitude (B2S). Ones Complement (B2O). scheme size in bits (w) minimum value maximum value B2U 5 0 31 B2U 8 0 255

More information

Floating-Point Arithmetic

Floating-Point Arithmetic Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } L11 Floating Point 1 What is the problem? Many numeric applications require numbers over a VERY large range. (e.g. nanoseconds to centuries)

More information

COPYRIGHTED MATERIAL. Number Systems. 1.1 Analogue Versus Digital

COPYRIGHTED MATERIAL. Number Systems. 1.1 Analogue Versus Digital 1 Number Systems The study of number systems is important from the viewpoint of understanding how data are represented before they can be processed by any digital system including a digital computer. It

More information

Objectives. Connecting with Computer Science 2

Objectives. Connecting with Computer Science 2 Objectives Learn why numbering systems are important to understand Refresh your knowledge of powers of numbers Learn how numbering systems are used to count Understand the significance of positional value

More information

Chapter 4: Data Representations

Chapter 4: Data Representations Chapter 4: Data Representations Integer Representations o unsigned o sign-magnitude o one's complement o two's complement o bias o comparison o sign extension o overflow Character Representations Floating

More information

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras

Numbers and Computers. Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras Numbers and Computers Debdeep Mukhopadhyay Assistant Professor Dept of Computer Sc and Engg IIT Madras 1 Think of a number between 1 and 15 8 9 10 11 12 13 14 15 4 5 6 7 12 13 14 15 2 3 6 7 10 11 14 15

More information

CHAPTER 2 Data Representation in Computer Systems

CHAPTER 2 Data Representation in Computer Systems CHAPTER 2 Data Representation in Computer Systems 2.1 Introduction 37 2.2 Positional Numbering Systems 38 2.3 Decimal to Binary Conversions 38 2.3.1 Converting Unsigned Whole Numbers 39 2.3.2 Converting

More information

unused unused unused unused unused unused

unused unused unused unused unused unused BCD numbers. In some applications, such as in the financial industry, the errors that can creep in due to converting numbers back and forth between decimal and binary is unacceptable. For these applications

More information

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. CS 320 Ch 10 Computer Arithmetic The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop. Signed integers are typically represented in sign-magnitude

More information

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers

Real Numbers finite subset real numbers floating point numbers Scientific Notation fixed point numbers Real Numbers We have been studying integer arithmetic up to this point. We have discovered that a standard computer can represent a finite subset of the infinite set of integers. The range is determined

More information

Computer Systems Programming. Practice Midterm. Name:

Computer Systems Programming. Practice Midterm. Name: Computer Systems Programming Practice Midterm Name: 1. (4 pts) (K&R Ch 1-4) What is the output of the following C code? main() { int i = 6; int j = -35; printf( %d %d\n,i++, ++j); i = i >

More information

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010

Number Systems and Conversions UNIT 1 NUMBER SYSTEMS & CONVERSIONS. Number Systems (2/2) Number Systems (1/2) Iris Hui-Ru Jiang Spring 2010 Contents Number systems and conversion Binary arithmetic Representation of negative numbers Addition of two s complement numbers Addition of one s complement numbers Binary s Readings Unit.~. UNIT NUMBER

More information

Computer Organisation CS303

Computer Organisation CS303 Computer Organisation CS303 Module Period Assignments 1 Day 1 to Day 6 1. Write a program to evaluate the arithmetic statement: X=(A-B + C * (D * E-F))/G + H*K a. Using a general register computer with

More information

Signed umbers. Sign/Magnitude otation

Signed umbers. Sign/Magnitude otation Signed umbers So far we have discussed unsigned number representations. In particular, we have looked at the binary number system and shorthand methods in representing binary codes. With m binary digits,

More information

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor. https://xkcd.com/217/

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor. https://xkcd.com/217/ CS 261 Fall 2017 Mike Lam, Professor https://xkcd.com/217/ Floating-Point Numbers Floating-point Topics Binary fractions Floating-point representation Conversions and rounding error Binary fractions Now

More information

Floating Point Numbers. Lecture 9 CAP

Floating Point Numbers. Lecture 9 CAP Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:

More information

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation Course Schedule CS 221 Computer Architecture Week 3: Information Representation (2) Fall 2001 W1 Sep 11- Sep 14 Introduction W2 Sep 18- Sep 21 Information Representation (1) (Chapter 3) W3 Sep 25- Sep

More information

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2)

ECE2049: Embedded Computing in Engineering Design C Term Spring Lecture #3: Of Integers and Endians (pt. 2) ECE2049: Embedded Computing in Engineering Design C Term Spring 2018 Lecture #3: Of Integers and Endians (pt. 2) Reading for Today: Davies Ch 2, MSP430 User's Guide Ch 6.1, 6.3 Reading for Next Class:

More information

CHAPTER 1 Numerical Representation

CHAPTER 1 Numerical Representation CHAPTER 1 Numerical Representation To process a signal digitally, it must be represented in a digital format. This point may seem obvious, but it turns out that there are a number of different ways to

More information

CPS 104 Computer Organization and Programming Lecture-2 : Data representations,

CPS 104 Computer Organization and Programming Lecture-2 : Data representations, CPS 104 Computer Organization and Programming Lecture-2 : Data representations, Sep. 1, 1999 Dietolf Ramm http://www.cs.duke.edu/~dr/cps104.html CPS104 Lec2.1 GK&DR Fall 1999 Data Representation Computers

More information

Integers and Floating Point

Integers and Floating Point CMPE12 More about Numbers Integers and Floating Point (Rest of Textbook Chapter 2 plus more)" Review: Unsigned Integer A string of 0s and 1s that represent a positive integer." String is X n-1, X n-2,

More information

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Floating Point. CSE 351 Autumn Instructor: Justin Hsia Floating Point CSE 351 Autumn 2017 Instructor: Justin Hsia Teaching Assistants: Lucas Wotton Michael Zhang Parker DeWilde Ryan Wong Sam Gehman Sam Wolfson Savanna Yee Vinny Palaniappan http://xkcd.com/571/

More information

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor.

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor. CS 261 Fall 2018 Mike Lam, Professor https://xkcd.com/217/ Floating-Point Numbers Floating-point Topics Binary fractions Floating-point representation Conversions and rounding error Binary fractions Now

More information

EE292: Fundamentals of ECE

EE292: Fundamentals of ECE EE292: Fundamentals of ECE Fall 2012 TTh 10:00-11:15 SEB 1242 Lecture 22 121115 http://www.ee.unlv.edu/~b1morris/ee292/ 2 Outline Review Binary Number Representation Binary Arithmetic Combinatorial Logic

More information

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal

Positional notation Ch Conversions between Decimal and Binary. /continued. Binary to Decimal Positional notation Ch.. /continued Conversions between Decimal and Binary Binary to Decimal - use the definition of a number in a positional number system with base - evaluate the definition formula using

More information

Representing and Manipulating Floating Points

Representing and Manipulating Floating Points Representing and Manipulating Floating Points Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu The Problem How to represent fractional values with

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Bits and Bytes and Numbers Number Systems Much of this is review, given the 221 prerequisite Question: how high can

More information

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer.

Digital Logic. The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. Digital Logic 1 Data Representations 1.1 The Binary System The Binary System is a way of writing numbers using only the digits 0 and 1. This is the method used by the (digital) computer. The system we

More information

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties

Systems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for

More information

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar Data Representation COE 30 Computer Organization Prof. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals Presentation Outline Positional Number

More information