On Mon, 29 Oct 2007, L wrote:

> > 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.

The programmer definitely should care. He has to make the right choice
in what type he chooses, so he must be aware of any 'quircks' of the type
he is using, and that includes how things are rounded and how they are
stored in memory. That's why there are IEEE references for this.

It's his job to make sure that the end user gets something sensible on the
screen, and that includes rounding to a usable number of digits.

The currency type calculates with a certain precision for you if you really
don't want to be bothered with the gory details. The opposite side of the
medal is that it's limited to 4 digits, and cannot be larger than 2^59 or
thereabouts.

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to