After casting float to float/int returned different result
<p>In my original code it is,</p>

<pre><code>approach += sign * (1.0/n);
</code></pre>

<p>But after adding a float cast to it:</p>

<pre><code>approach += sign * (float)(1.0/n);
</code></pre>

<p>the final result changed. <code>approach</code> is defined as <code>float</code> while <code>sign</code> and <code>n</code> are <code>integers</code>.
 From what I've learned, 1.0/n should cast <code>n</code> to float and in the first version it should be equivalent of </p>

<pre><code>approach += sign * (1.0/(float)n);
</code></pre>

<p>and <code>(1.0/(float)n)</code> is a float itself, casting a float to it shouldn't make any difference.
Obviously there is something wrong in my logic, please kindly point out.</p>