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.
On Mon, Aug 21, 2017 at 7:42 PM, Ralf Quint <freedos...@gmail.com> wrote: > On 8/21/2017 3:34 PM, Daniel Franzini wrote: > > It might be the case (I didn't do the math) that 999.999 doesn't have > > an exact representation in IEEE-754 double-precision format, so the > > best you get is an aproximation (a pretty good one, btw). > Just use WriteLn (Draw_GX_Min:3:16) and you get no mystery digits > anymore... > > In pretty much any programming language/compiler, if you print more > digits than the precision of the used variable defines, you will get > random numbers after the defined precision. > This is not something FreePascal specific, any C/C++ compiler for > example will do the same thing. People need to learn what limitations > come along with floating point variables/calculations... > > Ralf > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal > -- Daniel "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) "Yes, technogeeks can be funny, even if only to each other." ( http://www.boogieonline.com/revolution/science/humor/)" "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'')
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal