Could someone explain this textbook example regarding float fl(x)

AI Thread Summary
The discussion centers on understanding how to compute the floating-point representation of 9.4, specifically how fl(9.4) is derived as 9.4 + 0.2 x 2^(-49). The binary representation of 9.4 is established as 1001.0110 0110 0110, with the decimal portion repeating. The confusion arises after discarding the infinite tail, where the rounding to the nearest rule is applied, leading to the addition of a small value. The explanation clarifies that the truncated part corresponds to 0.4 x 2^(-48), and the rounding adds a value of 2^(-49), resulting in the final expression. Overall, the arithmetic involved in combining these elements leads to the correct floating-point representation.
catsarebad
Messages
69
Reaction score
0
Hi,

okay here's the problem:

*find fl(x) for 9.4*

and here's how it's done

9.4 in binary is 1001.0110 0110 0110 since
9 = 1001
.4 = .0110 0110 0110... (basically, 0110 repeating)

next using Rounding to Nearest Rule (see top on picture) we get what a binary number (boxed in black in the picture below)

I understand how to do upto here perfectly however I do not understand what happens after that.

I'm confused by pretty much the entire thing that follows after "discarding the infinite tail". I do not understand how fl(9.4) turns out to be 9.4 + 0.2 x 2^(-49) (shown in red box in the picture).

could anyone provide explanation for this?

the book has another example similar to this but i couldn't follow either of them. i hope someone can explain me the basics of what is happening here.

http://i.imgur.com/IOpfVjm.jpg

(image not embedded because it is too big and breaks the thread)
 
Technology news on Phys.org
long story short, I'm trying to figure out how

fl(9.4) = 9.4 + 0.2 x 2^(-49)

without using computer
 
I'll take a stab at it:
The binary representation of 9.4 is standardized so that the leading digit before the decimal point is 1. That is how it will be stored in the computer and it let's you know how much will be truncated. The truncated part is a bit pattern that amounts to 0.4x(2^-48). The fl rule for rounding adds a digit that amounts to 2^-49. So the final bit pattern amounts to

9.4 + rounded - truncated = 9.4 + 2^-49 - 0.4 x (2^-48).

The rest is arithmetic.
 
Last edited:
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
Thread 'Project Documentation'
Trying to package up a small bank account manager project that I have been tempering on for a while. One that is certainly worth something to me. Although I have created methods to whip up quick documents with all fields and properties. I would like something better to reference in order to express the mechanical functions. It is unclear to me about any standardized format for code documentation that exists. I have tried object orientated diagrams with shapes to try and express the...
Back
Top