KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: SET REAL COMPARISON LEVEL
PRODUCT: 4D | VERSION: 2003.2 | PLATFORM: Mac & Win
Published On: February 12, 2004

Version 6.x and 2003.x

When dealing with real numbers, computers will approximate their values. Therefore, when testing real numbers for equality, 4D will calculate the difference between these numbers and compare it with a set value. This value in 4D is called epsilon and is set by default to 10^ -6 (0.000001).
For example, given two real numbers A and B:
if Abs(a-b) > epsilon, than the numbers are NOT equal
if Abs(a-b) < epsilon, than the numbers are equal

The command SET REAL COMPARISON LEVEL allows the user to change the epsilon value. Once this command is called, the value of epsilon will remain changed throughout the entire database. It is recommended to execute this command at startup, so that all of the remaining methods comparing real numbers against epsilon will reflect accurate results.