[fpc-pascal] Freepascal Floating Point Issue

Ralf Quint freedos.la at gmail.com
Tue Aug 22 00:42:34 CEST 2017


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




More information about the fpc-pascal mailing list