<div dir="ltr">Long story short: not every single real number have an *exact* representation in the computer. You have to live with that and learn the limitations and pitfalls of floating point calculations.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 21, 2017 at 7:42 PM, Ralf Quint <span dir="ltr"><<a href="mailto:freedos.la@gmail.com" target="_blank">freedos.la@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 8/21/2017 3:34 PM, Daniel Franzini wrote:<br>
> It might be the case (I didn't do the math) that 999.999 doesn't have<br>
> an exact representation in IEEE-754 double-precision format, so the<br>
> best you get is an aproximation (a pretty good one, btw).<br>
</span>Just use WriteLn (Draw_GX_Min:3:16) and you get no mystery digits anymore...<br>
<br>
In pretty much any programming language/compiler, if you print more<br>
digits than the precision of the used variable defines, you will get<br>
random numbers after the defined precision.<br>
This is not something FreePascal specific, any C/C++ compiler for<br>
example will do the same thing. People need to learn what limitations<br>
come along with floating point variables/calculations...<br>
<div class="HOEnZb"><div class="h5"><br>
Ralf<br>
<br>
---<br>
This email has been checked for viruses by Avast antivirus software.<br>
<a href="https://www.avast.com/antivirus" rel="noreferrer" target="_blank">https://www.avast.com/<wbr>antivirus</a><br>
<br>
______________________________<wbr>_________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.<wbr>org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal" rel="noreferrer" target="_blank">http://lists.freepascal.org/<wbr>cgi-bin/mailman/listinfo/fpc-<wbr>pascal</a></div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Daniel<br><br>"Let us change our traditional attitude to the construction of programs. Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings what we want a computer to do." (Donald Knuth)<br><br>"Yes, technogeeks can be funny, even if only to each other." (<a href="http://www.boogieonline.com/revolution/science/humor/" target="_blank">http://www.boogieonline.com/revolution/science/humor/</a>)"<br><br>"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software." (Yukihiro Matsumoto, a.k.a. ``Matz'')</div>
</div>