Android - exact mathematical calculation
<p>I have got a Problem, I am developing an Application which should be able to do some mathematic calculations. These calculations have to be exact (or rather not obviously wrong)</p>

<p>But this simple Code </p>

<pre><code>double a = 3.048d;
double b = 1000d;

double c = a / b;
</code></pre>

<p>gives me a wrong result c is not 0.003048 as expected instead it is 0.0030480000000000004 which is obviously wrong.</p>

<pre><code>double d = 3.048 / 1000; 
</code></pre>

<p>this second code-snipet gives the correct result.</p>

<p>I am aware that all floatingpoint arithmetic is not exact when calculating with computers but I don't know how to solve this problem. </p>

<p>thanks in advance!<br>
Ludwig</p>

<p>Developing for:<br>
- Android 2.2<br>
Testdevice:<br>
- HTC Desire</p>
