# L15 - CS61C Machine Structures Lecture 15 Floating Point...

This preview shows pages 1–4. Sign up to view the full content.

CS 61C L15 Floating Point I (1) Wawrzynek Fall 2007 © UCB 10/1/2007 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS61C – Machine Structures Lecture 15 - Floating Point Numbers I CS 61C L15 Floating Point I (2) Wawrzynek Fall 2007 © UCB Introduction ° What does the above bit pattern mean? “4UCB” ori \$21, \$2, 17218 878,003,010 ° Data can be anything. Its meaning is determined by how it is interpreted. (As an instruction, as an operand for a arithmetic instruction, …) ° And as we shall see today … as a ﬂoating point number. 0011 0100 0101 0101 0100 0011 0100 0010

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

View Full Document
CS 61C L15 Floating Point I (3) Wawrzynek Fall 2007 © 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) CS 61C L15 Floating Point I (4) Wawrzynek Fall 2007 © 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.
CS 61C L15 Floating Point I (5) Wawrzynek Fall 2007 © 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 5-bit representation: 10.101 2 = 1x2 1 + 1x2 -1 + 1x2 -3 = 2.625 10 If we assume “ﬁxed binary point”, range of 5-bit representations with this format: 0 to 3.9375 (almost 4) CS 61C L15 Floating Point I (6) Wawrzynek Fall 2007 © 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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

L15 - CS61C Machine Structures Lecture 15 Floating Point...

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

View Full Document
Ask a homework question - tutors are online