exact representation of double
Does anyone know how to exactly represent doubles like "0.1". I know that binary representation of decimal numbers are not always exact. What I am looking for is a technique to work around this problem.
when you do something like
double x = 0.1;
internally x is "0.10000..000001" (may have missed some zeros, but that is irrelevant; what is important here is the trailing 1)
what I want is to store x in some way so that it is "0.10000 ...00"
Also, some comments on double comparison will be helpful. I know about the "delta" technique; does anyone know of any other?
Your help is much appreciated.
Thanks.