Hello All,

Let's say that I have the number 123.3443.

Now, I want this to be re-written as 16166984/131072.

So, I kind of have a basic understanding of floats now. There's the sign (1 bit), the exponent (8 bits? 13?) and the mantissa (53 in my case, as I'm using doubles). Or I guess I could use floats instead of doubles but nevertheless...

So, 123.3443 would be written as +1.233443 x 10^2.

sign : 0

exponent : 127 + 2 = 129 (given that the exponent is zeroed at 127)

mantissa : 1.233443

Oh wait, I'm screwing this up. Basically, if we had 3.75 this would be written in its binary form as 11.11

Why?

3 = 11, obviously.

But .75 = 3 / 4 = 1/2 + 1/4 which is how the trailing numbers after the . work, diving by terms in the binary sequence.

So, I need to write code that convert the the remainder part more as a sum because 3 + .75 is indeed 3.75.

I know I need to count the length of the binary or at least, I need it to create the denominator. And I need to convert the decimal part into a fraction so I need the numerator as well.

Does anyone have an idea of how I would start this?