Dr. Chuck Cartledge. 3 June 2015

Similar documents
Dr. Chuck Cartledge. 15 July 2015

Floating Point Numbers

COMP2611: Computer Organization. Data Representation

ECE232: Hardware Organization and Design

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

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

Introduction to Scientific Computing Lecture 1

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

MA 1128: Lecture 02 1/22/2018

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

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

Number Systems and Computer Arithmetic

FLOATING POINT NUMBERS

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

Introduction to Computers and Programming. Numeric Values

Signed umbers. Sign/Magnitude otation

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

3.5 Floating Point: Overview

Computer Systems C S Cynthia Lee

Floating Point Numbers

Floating Point Numbers

Dr. Chuck Cartledge. 7 Nov. 2017

Divide: Paper & Pencil

Number Systems. Both numbers are positive

Numerical Precision. Or, why my numbers aren t numbering right. 1 of 15

Module 2: Computer Arithmetic

Up next. Midterm. Today s lecture. To follow

Variables and Data Representation

10.1. Unit 10. Signed Representation Systems Binary Arithmetic

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

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

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

Data Representation 1

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

CHW 261: Logic Design

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

Slide Set 11. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng

Computer Architecture and System Software Lecture 02: Overview of Computer Systems & Start of Chapter 2

15213 Recitation 2: Floating Point

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

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

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

FLOATING POINT NUMBERS

Slide Set 1. for ENEL 339 Fall 2014 Lecture Section 02. Steve Norman, PhD, PEng

Characters, Strings, and Floats

MACHINE LEVEL REPRESENTATION OF DATA

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

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

Table : IEEE Single Format ± a a 2 a 3 :::a 8 b b 2 b 3 :::b 23 If exponent bitstring a :::a 8 is Then numerical value represented is ( ) 2 = (

Numeric Encodings Prof. James L. Frankel Harvard University

A Level Computing. Contents. For the Exam:

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

Floating Point. CSE 351 Autumn Instructor: Justin Hsia

Test Results Schedule Miscellanea Control Structs. Add l Oper s Break Hands on Q & A Conclusion References Files

Topic Notes: Bits and Bytes and Numbers

2. MACHINE REPRESENTATION OF TYPICAL ARITHMETIC DATA FORMATS (NATURAL AND INTEGER NUMBERS).

ROUNDING ERRORS LAB 1. OBJECTIVE 2. INTRODUCTION

Rev Name Date. . Round-off error is the answer to the question How wrong is the rounded answer?

ECE331: Hardware Organization and Design

Bits, Words, and Integers

Today CISC124. Building Modular Code. Designing Methods. Designing Methods, Cont. Designing Methods, Cont. Assignment 1 due this Friday, 7pm.

Chapter 2. Data Representation in Computer Systems

Floating Point Representation in Computers

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

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

3. Simple Types, Variables, and Constants

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

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

LING 388: Computers and Language. Lecture 5

What Every Programmer Should Know About Floating-Point Arithmetic

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

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

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

IEEE Standard for Floating-Point Arithmetic: 754

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.

EE 109 Unit 19. IEEE 754 Floating Point Representation Floating Point Arithmetic

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

Overview (4) CPE 101 mod/reusing slides from a UW course. Assignment Statement: Review. Why Study Expressions? D-1

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.

8/30/2016. In Binary, We Have A Binary Point. ECE 120: Introduction to Computing. Fixed-Point Representations Support Fractions

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

IEEE Floating Point Numbers Overview

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

Data Representation Type of Data Representation Integers Bits Unsigned 2 s Comp Excess 7 Excess 8

Floating Point Arithmetic

Lecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS

CS61c Midterm Review (fa06) Number representation and Floating points From your friendly reader

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

Machine Arithmetic 8/31/2007

Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point

Topic Notes: Bits and Bytes and Numbers

CO212 Lecture 10: Arithmetic & Logical Unit

Lecture Numbers. Richard E Sarkis CSC 161: The Art of Programming

Level ISA3: Information Representation

COMP Overview of Tutorial #2

Kinds Of Data CHAPTER 3 DATA REPRESENTATION. Numbers Are Different! Positional Number Systems. Text. Numbers. Other

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

Floating Point. What can be represented in N bits? 0 to 2N-1. 9,349,398,989,787,762,244,859,087, x 1067

Foundations of Computer Systems

CPE 323 REVIEW DATA TYPES AND NUMBER REPRESENTATIONS IN MODERN COMPUTERS

Transcription:

Miscellanea 8224 Revisited Break 1.5 1.6 Conclusion References Backup slides CSC-205 Computer Organization Lecture #002 Section 1.5 Dr. Chuck Cartledge 3 June 2015 1/30

Table of contents I 5 1.6 1 Miscellanea 2 8224 Revisited 3 Break 4 1.5 6 Conclusion 7 References 8 Backup slides 2/30

Corrections and additions since last lecture. Correct typos 3/30

What is in a number?? 8224 10 => 10000000100000 2 8224 10 =>2020 16 8224 10 => ASCII Image from [3]. The language supported assigning strings to integers to save RAM. 8224 is two spaces. 4/30

Concept How we see bits depends on our viewing tool. Sometimes what we see is different than what we expect. 5/30

Concept And now we go live. Hold on. Things can get a little hairy. When in doubt, have backup slides. 6/30

Concept What is the takeaway?? What we see is determined by the tools we use. Different tools give us different views. Some tools constrain your view (without telling you.) Take a look at a PDF, eps, or gif file using the wrong tool. The more tools you have then more different views you can have. 7/30

Break time. Take about 10 minutes. 8/30

Real and floating point numbers So far we have only looked at integers, the counting numbers. What about real or floating point numbers?? How do we represent the value 5.375?? For integers: n= positions i=1 val i base (i 1) For floating point: n= positions i=1 val i base (i 1 m) m is the number of bits to the right of the decimal point If m=3 then 5.375 10 =101.011 2 9/30

Real and floating point numbers So how does this work?? We ll pick it apart. n= cellsize i=1 val i base (i 1 m) base =2,m=3 How do we represent the decimal point in binary?? 10/30

Real and floating point numbers Another mechanical way to convert to binary. Repeatedly divide the integer portion by 2 and record the remainder Repeatedly multiply the fractional portion by 2 and record the overflow 6.5859375 10 =110.10010111 2 Stop converting when the integer and fractional part are 0. 11/30

Real and floating point numbers What happens with messy numbers?? As an exercise, convert 1.2 (10) to binary..2 0.4 0.8 1.6 1.2 0.4 0.8 1.6 1.2 Some fractions can not be represented by a fixed length binary number... 12/30

Real and floating point numbers Our friend, scientific notation. A short hand way of writing numbers. Makes things like multiplication and division of large numbers trivial. A couple of examples. 328.4= 3.284 10 2 Three parts: 1 Sign (- in this case) 2 Coefficient (3.284 in this case), sometimes called the significand 3 Exponent (2 in this case) 4 Base (10 in this case) value = SignCoefficient Base Exponent Writing numbers in scientific notation is called normalized form. 13/30

Real and floating point numbers Remember the question about where do we store the decimal point?? When dealing with numbers in the normalized form, everyone knows where the decimal is, so no one has to store it. And because everyone knows that the most significant bit has to be 1, no has to store it. Hidden and excess bits are conventions that allow more bits to be used where they are needed. 14/30

Real and floating point numbers Special Values The limitation on the cell size (i.e., the number of bits we can use) places a limit on the range of values we can represent. We ve seen how ADDing can overflow a cell. Normalization limits the smallest coefficient that we can have greater than 0. Operations using values in range can result in values that can not be represented. Sign bit, 7 bit coeff, 5 bit expon. All of these errors can to caught by the CPU and software. 15/30

Real and floating point numbers There are too many possibilities. We need standardization. The IEEE 754 Floating Point Standard to the rescue. Each CPU manufacturer had their own floating point representation. Each felt their s was the best. Application software on one machine may not run correctly on another machine. 16/30

Real and floating point numbers IEEE 754 Special Values and Notes Predefined special values by the specification: Positive and negative infinity: sign 0/1, expon. all 1s, coeff all 0s Not a Number (NaN): sign 0/1, expon. all 1s, coeff anything except all 0s Precision: 2 149 1.17549 10 38 or 2 1074 4.94066 10 324 Rounding: nearest, even, 0, +/- infinity 17/30

Numbers at different levels Just a little C++ We ve talked about numbers and ASCII, lets put them to use. int declaration sets aside memory for a 2 s compliment integer char declaration sets aside memory for an 8 bit ASCII character cout << prints something to the screen This model is referred to often in [4]. You don t have to have taken a C++ course to get through this, but it helps. 18/30

Numbers at different levels Given the information from the previous slide... What does this code snippet do?? int j = 12; char c = j; cout << ch; What will I see on the screen?? 19/30

Numbers at different levels Given what we ve covered in class... How would I find out how many bits (or bytes) are in a Bloodshed int?? Class discussion. Why would I care?? 20/30

Numbers at different levels Other ways to represent numbers Binary Coded Decimal (BCD) each decimal digit is represented in one nibble. Gray code adjacent values differ by exactly one bit Non Zero Return (NZR) bits only change state if the original bits change Image from [2]. Lots of different ways to represent numbers. 21/30

Numbers at different levels Models...essentially, all models are wrong, but some are useful. George E. P. Box [1] Plato celestial spheres Copernicus earth (planets) revolves around the sun Brache Copernicus not quite correct Kepler planets revolve in ellipses All models have imperfections. 22/30

What have we covered? There are many different ways to look at bits Sections 1.5 and 1.6 Concept of More tools is better Concept of Your tools may be limiting you Exam on Chapter 1 Sections 2.1 through 2.4 23/30

References I [1] George E. P. Box and Norman R. Draper, Empirical Model-Building and Response Surfaces, High Occupancy Vehicle 4 (1987), 21. [2] Clive Maxfield, How to generate Gray Codes for non-power-of-2 sequences, http://www.eetimes.com/document.asp?doc id=1274581, 2007. [3] Museum of HP Calcualtors Staff, Hp 9830a, http://www.hpmuseum.org/hp9830.htm. [4] J. Stanley Warford, Computer Systems, Jones & Bartlett Publishers, 2010. 24/30

A Word 2010 file in Word. 25/30

A Word file on the file system. 26/30

A Word file outside of Word. 27/30

The raw Word word/document.xml file. 28/30

The pretty printed Word word/document.xml file. 29/30

A raw PDF file. 30/30