Diagnosing floating point calculations precision.

Details:

Do you have numeric problems with real numbers? This is not a specific problem of Component Pascal. All programming languages have the same kind of problem. Here is a little module to determine the precision of floating point calculations. The result depends on the floating point implementation on your machine and not of the programming language definition.

Testing REAL numbers for equality should be done with the statement:

IF (ABS (real1 - real2) < epsilon) THEN ... END;

The problem above is what value of epsilon should I use. After running this test you know which epsilon you can use on your machine. Remark: Math.Eps() gives the same value, but with less information.

Author: Gérard Meunier

Published by: Anton Shelin