[fpc-pascal] Re: Why this evaluates on "if" wrong ?
daniel.mantione at freepascal.org
Mon Oct 29 16:45:29 CET 2007
Op Mon, 29 Oct 2007, schreef Stephen Dickason:
> > It's just one more funny thing one must realize,
> > when comparing real numbers with some exact
> > real constants. After this, I will try to never
> > compare doubles directly, but using tricks like
> > above. Because, in this digital world
> > 1 + 0.4 - 0.4 <> 1.
> In binary that is 00000001 + 0.0110011001100.... - 0.0110011001100.... because
> we hit recurring decimals a lot more in binary than decimal. I wonder why we
> don't have a standard format (maybe we do?) that factors in the remainder as
> part of the number also?
The answer can be found in the fact that any number with recurring
decimals is a rational number and therefore does not need floating point
More information about the fpc-pascal