[fpc-pascal] Re: Why this evaluates on "if" wrong ?
daniel.mantione at freepascal.org
Mon Oct 29 14:53:11 CET 2007
Op Mon, 29 Oct 2007, schreef L:
> > 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.
> My opinion:
> This is ludicrous.
> The end user is using a high level language and should not care whether the
> computer is digital or analog.
> For example, my calculator subtracts 0.4 just fine, and it is digital!
Your Casio doesn't do comparisons. Just round to 10 digits before you
compare and it'll work just as fine as on your Casio.
More information about the fpc-pascal