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