Am 12.06.2018 um 09:01 schrieb Mattias Gaertner:
IMHO this is not really relevant, as relying on the exact value of a
real number is erroneous, anyway. So a real number never can be
considered to *exactly* *be* 1.5, but just somewhere nearby, and hence
it's not legal to predict hat it is rounded to.

Floats can represent 1.5 exactly.

Yes. And such numbers do pop up all the time.

That mathematical theory is only valid for measured values. If measured with unlimited precision.

Then you could arbitrarily define round(1.5)=9, and nobody would ever notice. Because the chance would be zero that a variable ever has that exact value.

But we do not only store measured values in variables. And we often measure with low precision. That's why this is relevant.

When I got different results from the FreePascal port of my source, it took me quite a while until I found the cause in the compiler. Because that is typically not the first place to look at.

Klaus
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to