<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Don't compare floating points. Ever. Now you see why.<div><br></div><div>Also, don't write loops that calculate a floating point number which is then tested for equality to exit the loop. Also, it is a bad idea to test for > or < for exiting unless you know in advance an accidental equality result will not yield surprising results. In other other words, don't do that (test for > or <) either.</div><div><br></div><div>Jerry</div><div><br><div><div>On Feb 26, 2010, at 3:37 AM, ik wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hello,<br><br>I've made a small test:<br><br>if (0.1+0.2) = 0.3 then<br><br>The only compiler/interpator that actually tells that it equal is FPC.<br><br>I've tested it using Javascript (in Firefox), Ruby, Python, C (gcc) and Perl.<br> <br>Except FPC, everyone tells that 0.1+0.2 = 0.30000000000000004<br><br>Can someone explain how FPC see the result and why others does not see it like that ?<br><br><br>Thanks,<br>Ido<br><br clear="all"><a href="http://ik.homelinux.org/">http://ik.homelinux.org/</a><br> </div> _______________________________________________<br>fpc-pascal maillist  -  <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br><a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a></blockquote></div><br></div></body></html>