Digital Computers and Machine Representation of Data

Similar documents
MACHINE LEVEL REPRESENTATION OF DATA

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

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

Chapter 4: Computer Codes. In this chapter you will learn about:

Basic data types. Building blocks of computation

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

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

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

Number Systems. Both numbers are positive

Digital Fundamentals

Final Labs and Tutors

Beyond Base 10: Non-decimal Based Number Systems

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

Binary. Hexadecimal BINARY CODED DECIMAL

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

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

ECE232: Hardware Organization and Design

Experimental Methods I

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

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

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 Fundamentals

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

Beyond Base 10: Non-decimal Based Number Systems

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

IEEE Standard for Floating-Point Arithmetic: 754

Chapter 11 : Computer Science. Information Representation. Class XI ( As per CBSE Board) New Syllabus

CHW 261: Logic Design

The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information.

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

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

Number codes nibble byte word double word

COMP Overview of Tutorial #2

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

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Invitation to Computer Science, C++ Version, Third Edition

Variables and Data Representation

CMPS 10 Introduction to Computer Science Lecture Notes

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

unused unused unused unused unused unused

Module 2: Computer Arithmetic

Introduction to Informatics

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

15213 Recitation 2: Floating Point

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Signed Binary Numbers

Chapter 2. Data Representation in Computer Systems

Number Systems. TA: Mamun. References: Lecture notes of Introduction to Information Technologies (ITEC 1011) by Dr Scott MacKenzie

CMPE223/CMSE222 Digital Logic Design. Positional representation

Lecture (01) Digital Systems and Binary Numbers By: Dr. Ahmed ElShafee

CMPSCI 145 MIDTERM #1 Solution Key. SPRING 2017 March 3, 2017 Professor William T. Verts

Objectives. Connecting with Computer Science 2

DATA REPRESENTATION. By- Neha Tyagi PGT CS KV 5 Jaipur II Shift, Jaipur Region. Based on CBSE curriculum Class 11. Neha Tyagi, KV 5 Jaipur II Shift

CS 31: Intro to Systems Binary Representation. Kevin Webb Swarthmore College January 27, 2015

What we need to know about error: Class Outline. Computational Methods CMSC/AMSC/MAPL 460. Errors in data and computation

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

Hexadecimal Numbers. Journal: If you were to extend our numbering system to more digits, what digits would you use? Why those?

Number Systems. Dr. Tarek A. Tutunji Philadelphia University, Jordan

Representing and Manipulating Floating Points. Jo, Heeseung

OBJECTIVES After reading this chapter, the student should be able to:

COMP2121: Microprocessors and Interfacing. Number Systems

LAB WORK NO. 2 THE INTERNAL DATA REPRESENTATION

Electronic Data and Instructions

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

Introduction to Scientific Computing Lecture 1

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

Inf2C - Computer Systems Lecture 2 Data Representation

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

Section 1.4 Mathematics on the Computer: Floating Point Arithmetic

Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

CS 101: Computer Programming and Utilization

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Lecture 2: Number Systems

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

CHAPTER 2 Data Representation in Computer Systems

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

CHAPTER 2 Data Representation in Computer Systems

COMP2611: Computer Organization. Data Representation

M1 Computers and Data

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

Intermediate Programming & Design (C++) Notation

Computer Organization and Assembly Language. Lab Session 4

DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes. Error Detection Codes

Floating-point representation

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

EE292: Fundamentals of ECE

Introduction to Computers and Programming. Numeric Values

Data Representation COE 301. Computer Organization Prof. Muhamed Mudawar

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

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

Chapter 3: Arithmetic for Computers

Data Representation 1

Floating Point Arithmetic

A Level Computing. Contents. For the Exam:

Level ISA3: Information Representation

Computer Organization and Assembly Language. Lab Session 01

1. Which of the following Boolean operations produces the output 1 for the fewest number of input patterns?

CSE 1320 INTERMEDIATE PROGRAMMING - OVERVIEW AND DATA TYPES

Divide: Paper & Pencil

Lecture (01) Introduction Number Systems and Conversion (1)

Transcription:

Digital Computers and Machine Representation of Data K. Cooper 1 1 Department of Mathematics Washington State University 2013

Computers Machine computation requires a few ingredients: 1 A means of representing numbers physically 2 A means of manipulating those physical representations to do arithmetic There are several options Mechanical representations - abacus, adding machine Analog electric - oscilloscope, analog computer Digital electric Biological - DNA sequences

Digital Computers Represent numbers by electric or magnetic charges Easiest, fastest, most failsafe to use binary E.g. +12v represents 1; 0v represents 0. Thus numbers are represented in binary arithmetic Note that this is not inevitable. One could make a computer that represented 0 by 0v, 1 by 1v, 2 by 2v, and so on. Implementation is more difficult. Virtually all modern digital computers use binary. Each binary digit is called a bit.

Arithmetic Base 2: 1 0 2 1 3 10 4 11 5 100 6 101 7 110 8 111 9 1000

Base b Arithmetic 1 0, 1, 2,..., b 1 2 10, 11,..., 1(b 1) 3 In general x k x k 1... x 0 represents x k b k + x k 1 b k 1 + + x 0 b 0. 4 E.g. In base 7, then 666 7 = 6 7 2 + 6 7 1 + 6 7 0 = 342 10

to Decimal Convert 10010 2 to decimal Five digits, so k = 4 10010 2 = 1 2 4 + 0 2 3 + 0 2 2 + 1 2 1 + 0 2 0 = 18 10

Decimal to Convert 423 to binary What is the largest power of 2 less than 423? It is 2 8 = 256. There is one 2 8 in 423. Find the remainder: 423 2 8 = 167. There is one 2 7 = 128 in 167. Find the remainder: 167 128 = 39 There is no 2 6 = 64 in 39, but there is one 2 5 = 32. The remainder is 39 32 = 7. There is no 2 4 = 16 nor 2 3 = 8 in 7, but there is one 4, one 2, and one 1. Thus 423 10 = 110100111 2. Whew!

Hexadecimal to Decimal Hexadecimal: base 16 Counting: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F, 10,... Convert 3FE 16 to decimal Three digits, so k = 2; 3FE 16 = 3 16 2 + F 16 1 + E 16 0 = 768 + 240 + 14 = 1022

Decimal to Hex Convert 423 to hex What is the largest power of 16 less than 423? It is 16 2 = 256; There is one 16 2 in 423. Find the remainder: 167 again. There are A 16s in 167, leaving 7 over; Thus 423 10 = 1A7 16

Hexadecimal to We could convert to decimal and then to binary but that would silly! Each hex digit corresponds to four binary digits: so we can just write each hex digit as binary and line them up. 1A7 16 = {0001}{1010}{0111} = 110100111 2. AAA 16 = {1010}{1010}{1010} = 101010101010 2. D0D 16 = {1101}{0000}{1101} = 110100001101 2.

to Hex Same deal - just group binary digits in fours, from right. 110011 2 = 0011 }{{} 0011 }{{} = 33 16 101110011 2 = 0001 }{{} 0111 }{{} 0011 }{{} = 173 16 10111100000 2 = 0101 }{{} 1110 }{{} 0000 }{{} = 5E0 16 One could do this to use other bases that are powers of two, e.g. octal.

Numbers Words What is a computer number? Some collection of bits. Computer memory organized by bytes 8 bits. Bytes are organized by words, which characterize the architecture of a computer. Ancient Apple computers used one-byte words memory was organized one byte at a time, CPU registers were one byte... 8-bit operating system Early DOS/Windows computers used 16-bits; two bytes 80s Unix computers and 90s Windows NT computers used 32-bit 80s scientific computers and most modern computers use 64-bit

Numbers Integers Typically one word One bit for sign: 0 positive, 1 negative. In a 16-bit integer that leaves 2 15 = 32768 numbers. The larger the number of bits to store the number, the more integers can be represented. There is a largest computer integer that a computer can represent. Memory addresses are one-word integers A 32-bit machine can have at most 4GB of memory

Numbers Floating Point What about non-integers - scientific computation? Use decimal notation Only finitely many digits Must represent very tiny numbers, and very large ones Use scientific notation b 10 k b and k are binary, and need a couple of sign bits There are largest and smallest numbers that can be represented.

Numbers 16-bit Floating Point 10-bit mantissa with 1 sign bit Integers from -1024 to 1024 5 bits for exponent: numbers from 0 to 31, shifted 360 10 0 is in this set. 36 10 1 would be the same number. Mantissas are normalized for maximal significance Exponents thus run from 14 to +15. Avogadro s number (6.022 10 23 ) cannot be represented in 16-bit floating point.

Numbers IEEE 754 IEEE Institute of Electrical and Electronics Engineers - standards organization 32-bit floating point 23-bit mantissa, 1 sign bit 8-bit exponent, shifted range from -126 to +127 Effectively represents about 7 decimal digits 64-bit floating point 52-bit mantissa, 1 sign bit 11-bit exponent, shifted range from -1022 to +1023 Effectively represents almost 16 decimal digits

Characters Characters ASCII - American Standard Code for Information Interchange Maps 7-bit integers to characters

Characters Unicode ASCII proved limited Unicode now supports much larger character sets UTF-8, UTF-16, UTF-32