L11-ac-fp1-6up

L11-ac-fp1-6up - inst.eecs.berkeley.edu/~cs61c CS61C :...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS61C L11 Floating Point I (1) Chae, Summer 2008 © UCB Albert Chae, Instructor inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 – Floating Point I 2008-7-9 Upcoming Programming Contests! http://www.icfpcontest.org/ 7/11-7/14 http://code.google.com/codejam/ 7/16 qualifiers QuickTime™ and a TIFF (Uncompres ed) decompres or are ne ded to se this picture. CS61C L11 Floating Point I (2) Chae, Summer 2008 © UCB Review MIPS Machine Language Instruction : 32 bits representing a single instruction Branches use PC-relative addressing, Jumps use absolute (actually, pseudo- direct) addressing. Disassembly is simple and starts by decoding opcode field. (more tomorrow) opcode rs rt immediate opcode rs rt rd funct shamt R I J target address opcode CS61C L11 Floating Point I (3) Chae, Summer 2008 © UCB Quote of the day 95% of the folks out there are completely clueless about floating-point.” James Gosling Sun Fellow Java Inventor 1998-02-28 CS61C L11 Floating Point I (4) Chae, Summer 2008 © UCB 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: 0 to 2 N - 1 (for N=32, 2 N –1 = 4,294,967,295) Signed Integers (Two’s Complement) -2 (N-1) to 2 (N-1) - 1 (for N=32, 2 (N-1) = 2,147,483,648) CS61C L11 Floating Point I (5) Chae, Summer 2008 © UCB What about other numbers? 1. Very large numbers? (seconds/millennium) 31,556,926,000 10 (3.1556926 10 x 10 10 ) 2. Very small numbers? (Bohr radius) 0.0000000000529177 10 m (5.29177 10 x 10 -11 ) 3. Numbers with both 1.5 First consider #3. …our solution will also help with 1 and 2. CS61C L11 Floating Point I (6) Chae, Summer 2008 © UCB Representation of Fractions (1/2) With base 10, we have a decimal point to separate integer and fraction parts to a number. 20.4005 = 2x10 1 + 4x10 -1 + 5x10 -4 xx . yyyy 10 1 10 0 10 -1 10 -2 10 -3 10 -4
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CS61C L11 Floating Point I (7) Chae, Summer 2008 © UCB Representation of Fractions (2/2) “Binary Point” like decimal point signifies boundary between integer and fractional parts: xx . yyyy 2 1 2 0 2 -1 2 -2 2 -3 2 -4 Example 6-bit representation: 10.1010 2 = 1x2 1 + 1x2 -1 + 1x2 -3 = 2.625 10 If we assume “fixed binary point”, range of 6-bit representations with this format: 0 to 3.9375 (almost 4) CS61C L11 Floating Point I (8) Chae, Summer 2008 © UCB Fractional Powers of 2 0 1.0 1 1 0.5 1/2 2 0.25 1/4 3 0.125 1/8 4 0.0625 1/16 5 0.03125 1/32 6 0.015625 7 0.0078125 8 0.00390625 9 0.001953125 10 0.0009765625 11 0.00048828125 12 0.000244140625 13 0.0001220703125 14 0.00006103515625 15 0.000030517578125 i 2 -i CS61C L11 Floating Point I (9) Chae, Summer 2008 © UCB Representation of Fractions with Fixed Pt. What about addition and multiplication?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

L11-ac-fp1-6up - inst.eecs.berkeley.edu/~cs61c CS61C :...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online