At 16:30 2003-1-24 -0500, you wrote:
The question is, can 12.91100000000000 and 5.000000000000000 be exactly expressed in double-precision floating point. For 5.0, the answer is yes. However, for 12.9110, the answer is no. Remember that the real representation is a binary fraction, so 12.9110 is> Search this forum's archives for other suggestions made in the past. > >It's only a "problem" in the way that computers represent floating point > >numbers internally. I used to have a pointer to a paper that described > >what goes on under the covers, but I can't lay my hands on it at the > >moment. A google search should be able to turn up something. > > What Every Computer Scientist Should Know About Floating Point > http://docs.sun.com/source/806-3568/ncg_goldberg.htmlGood article. Thanks, Ben. But are you saying that there is NOT a problem with double multiplication? I.e., the posting below is mistaken? (BTW: Emulated FP is not intrinsically less accurate/precise than hardware FP.)
8 + 4 + 1/2 + 1/4 + 1/8 + 1/32 + 1/128 + ...
Is there a set of roots of two that will add up precisely to 12.9110? No. So, there already is rounding converting that decimal form to binary. Multiply it by five and convert back, and you get the error that was seen.
--
Ben Combee <[EMAIL PROTECTED]>
CodeWarrior for Palm OS technical lead
Palm OS programming help @ www.palmoswerks.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
