Summing up float number loses precision with type conversion
<p>I tried to add two digits with different weights. Here is my code:</p>

<pre><code>void onTimeStepOp::updatePointsType1_2(boost::tuples::tuple&lt;float,int,int,int&gt; &amp;_prev,
                                     boost::tuples::tuple&lt;float,int,int,int&gt; &amp;_result,
                                       boost::tuples::tuple&lt;float,float&gt; weights)
{
    _result.get&lt;0&gt;() = _result.get&lt;0&gt;() * weights.get&lt;0&gt;() + _prev.get&lt;0&gt;() * weights.get&lt;1&gt;();
    std::cout&lt;&lt;"deb:"&lt;&lt;(float)_result.get&lt;2&gt;() * weights.get&lt;0&gt;()&lt;&lt;" "&lt;&lt;(float)_prev.get&lt;2&gt;() * weights.get&lt;1&gt;()&lt;&lt;std::endl;
    _result.get&lt;2&gt;() = (int)((float)(_result.get&lt;2&gt;()) * weights.get&lt;0&gt;() + (float)(_prev.get&lt;2&gt;()) * weights.get&lt;1&gt;());
    std::cout&lt;&lt;"deb2:"&lt;&lt;(float)_result.get&lt;3&gt;() * weights.get&lt;0&gt;() &lt;&lt;" "&lt;&lt; (float)_prev.get&lt;3&gt;() * weights.get&lt;1&gt;()&lt;&lt;std::endl;
    _result.get&lt;3&gt;() = (int)((float)(_result.get&lt;3&gt;()) * weights.get&lt;0&gt;() + (float)(_prev.get&lt;3&gt;()) * weights.get&lt;1&gt;());
}
</code></pre>

<p>weights.get&lt;0> = 0.3,weights.get&lt;1> = 0.7.</p>

<p>The output I get looks like this:</p>

<pre><code>resultBefore=36.8055 4 69 91 previousPPos=41.192 4 69 91
deb:20.7 48.3
deb2:27.3 63.7
resultAfter=39.8761 4 **68** 91
</code></pre>

<p>The third number should be 69(69 * 0.3 + 69 * 0.7). However, it is 68 instead. What's the problem with the type conversion expression?</p>
