2008Sp61C-L15-dj-FloatingPointI-6up

2008Sp61C-L15-dj-FloatingPointI-6up -...

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

View Full Document Right Arrow Icon
CS61C L15 Floating Point I (1) Jacobs, Spring 2008 © UCB TA Ordinaire Dave Jacobs www.ocf.berkeley.edu/~djacobs inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 15 Floating Point I 2008-02-27 “Doomsday” Seed Vault Opens “The seed bank on a remote island near the Arctic Ocean is considered the ultimate safety net for the world's seed collections, protecting them from a wide range of threats including war, natural disasters, lack of funding or simply poor agricultural management.” www.cnn.com/2008/WORLD/europe/02/26/norway.seeds/index.html#cnnSTCText CS61C L15 Floating Point I (2) Jacobs, Spring 2008 © UCB Quote of the day 95% of the folks out there are completely clueless about ±oating-point.” James Gosling Sun Fellow Java Inventor 1998-02-28 CS61C L15 Floating Point I (3) Jacobs, Spring 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 L15 Floating Point I (4) Jacobs, Spring 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 L15 Floating Point I (5) Jacobs, Spring 2008 © UCB Representation of Fractions “Binary Point” like decimal point signi²es 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 “Fxed binary point”, range of 6-bit representations with this format: 0 to 3.9375 (almost 4) CS61C L15 Floating Point I (6) Jacobs, Spring 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
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 L15 Floating Point I (7) Jacobs, Spring 2008 © UCB Representation of Fractions with Fixed Pt. What about addition and multiplication? Addition is straightforward: 01.100 1.5 10 00.100 0.5 10 10.000 2.0 10 Multiplication a bit more complex: 01.100 1.5 10 00.100 0.5 10 00 000 000 00 0110 0 00000 00000 0000110000 HI LOW Where ʼ s the answer, 0.11 ? (need to remember where point is) CS61C L15 Floating Point I (8) Jacobs, Spring 2008 © UCB Representation of Fractions So far, in our examples we used a “±xed” binary point what we really want is to “²oat” the binary point. Why? Floating binary point most effective use of our limited bits
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 / 5

2008Sp61C-L15-dj-FloatingPointI-6up -...

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