This is not even squeak specific. Decimal floats not always can be represented precisely in binary form:<br><br><a href="http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems">http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems</a><br>
<br><br><br><div><span class="gmail_quote">2008/2/17, cdrick &lt;<a href="mailto:cdrick65@gmail.com">cdrick65@gmail.com</a>&gt;:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I noticed in my image (damien last beta so 3.10 - windows XP and<br>Vista) that I have a strange bug when soustracting floats<br>successively. Here is how I reproduce it in a workspace:<br><br>1 - 0.2 -0.05 -0.3 = 0.45 &quot;true&quot;<br>
1 - 0.2 -0.05 -0.3 -0.1= 0.35&nbsp;&nbsp;&quot;true&quot;<br>1 - 0.2 -0.05 -0.3 -0.1 - 0.10= 0.25&nbsp;&nbsp;&quot;*****false*****&quot;<br>1 - 0.2 -0.05 -0.3 -0.1 - 0.10= 0.24999999999999995&nbsp;&nbsp; true<br><br>or again:<br>1 - 0.1 = 0.9&nbsp;&nbsp;true<br>
1 - 0.1 - 0.1 = 0.8 true<br>1 - 0.1 - 0.1 - 0.1 = 0.7 false<br><br><br>Can somebody explain that or is it a bug ? I don&#39;t know yet if it&#39;s<br>specific to my image, so does other have the same behavior?<br>I can force the rounding of the result but find it strange.<br>
<br>Cédrick<br><br><br><br></blockquote></div><br>