10/6/04

A student asks about representing floating point, but he is really asking about going from decimal to binary, when he has a non-exact fractional part.

Based on his question, it sounds like once he has the binary representation, he can package it into fractional part and exponent part.

```     Professor Patt,

I have just been reviewing everything from Ch1
through where we are now and
when I got to the floating point section in the
book, I understand using 32
bits to represent floating point numbers
in binary and the formula used to
convert from binary to decimal but
now I have a question about the reverse.
The example in the book showed how to
convert the decimal number -6(5/8) to
binary which is very simple because
5/8 = .625.  Well, what about say, 1/3?
How would you represent .333, .235, .739, etc?
(Numbers that don't fit nicely with 2-1-, 2-2, etc.)  Thank you!

<< Name withheld to protect ..>> (thought I'd save you the trouble)```

I assume you were not at the review session last night, when we went through very carefully the example: convert 1.3 to binary. The same technique for .3 will hold for .333, .235, etc.

Were any members of your study group at the review session? If so, and they wrote down what I put on the board, you might want to look at that.

If you are studying alone or none of your study group were at the review session last night, ask me again, and I will answer. ...although it is much easier to get this if we are in the same room and you can ask questions each time I write something on the board.

In any case, good luck on the exam.

Yale Patt