SET REAL COMPARISON LEVEL

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


SET REAL COMPARISON LEVEL (epsilon)

ParameterTypeDescription
epsilonNumberEpsilon value for real equality comparisons

Description

The SET REAL COMPARISON LEVEL command sets the epsilon value used by 4th Dimension to compare real values and expressions for equality.

A computer always performs approximative real computations; therefore, testing real numbers for equality should take this approximation into account. 4th Dimension does this when comparing real numbers by testing whether or not the difference between the two numbers exceeds a certain value. This value is called the epsilon and works this way:

Given two real numbers a and b, if Abs(a-b) is greater than the epsilon, the numbers are considered not equal; otherwise, the numbers are considered equal.

By default, 4th Dimension, sets the epsilon value to 10 power minus 6 (10^-6). Please note that the epsilon value should always be positive. Examples:

0.00001=0.00002 returns False, because the difference 0.00001 is greater than 10^-6.

0.000001=0.000002 returns True, because the difference 0.000001 is not greater than 10^-6.

0.000001=0.000003 returns False, because the difference 0.000002 is greater than 10^-6.

Using SET REAL COMPARISON LEVEL, you can increase or decrease the epsilon value as you require.

Note: If you want to execute a query or an "Order by" on a numeric indexed field whose values are lower than 10^-6, make sure that the SET REAL COMPARISON LEVEL command is executed before construction of the index.

WARNING: Typically, you will not need to use this command to change the default epsilon value.

IMPORTANT: Changing the epsilon only affects real comparison for equality. It has no effect on other real computations nor on the display of real values.

See Also

Comparison Operators.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next