[fpc-pascal] floating point an FPC
Jonas Maebe
jonas.maebe at elis.ugent.be
Fri Feb 26 12:00:12 CET 2010
On 26 Feb 2010, at 11:37, ik wrote:
> I've made a small test:
>
> if (0.1+0.2) = 0.3 then
>
> The only compiler/interpator that actually tells that it equal is FPC.
Then you are very lucky that FPC says it is equal.
> I've tested it using Javascript (in Firefox), Ruby, Python, C (gcc)
> and
> Perl.
They are just as correct as FPC.
> Except FPC, everyone tells that 0.1+0.2 = 0.30000000000000004
And that answer is also correct.
> Can someone explain how FPC see the result and why others does not
> see it
> like that ?
It's because of the way floating point works. Read e.g. http://www.lahey.com/float.htm
Jonas
More information about the fpc-pascal
mailing list