PURPOSE: The EXACT option controls numeric comparison of numbers in field types FLOAT and REAL. This command is valid in a CM, PM, SF or as a direct command.
{ENABLE; DISABLE} EXACT /COMPARE/ [{IF; UNLESS} clause]
ENABLE |
causes exact machine word comparison of a floating point numbers. |
DISABLE |
compares floating point numbers within the tolerance of @EPS. This is the default state. |
{IF; UNLESS} clause |
specifies certain criteria that must be met for the ENABLE or DISABLE command to take effect. |
*SET 7.12 TO @NUMBER(1)
*TYPE @NUMBER (1)
7.12
*TYPE @NUMBER @ '2Z.24Z'
7.119999999999999995559108
*TYPE @EPS
IE-16
*TYPE @EPS@ 'D.16D'
0.0000000000000001
*TYPE "OK" IF 7.12 + 5.02 = 12.14
OK
*ENABLE EXACT
*TYPE "NOT EQUAL" IF 7.12 + 5.02 # 12.14
NOTES: If the EXACT option is not enabled, ACCENT R by default compares numerical values within 1E-16 on OpenVMS VAX and 1E-15 on OpenVMS Alpha to circumvent the intrinsic problems of storing decimal values in binary computers. The displayed results of these arithmetic operations are usually correct even though the results may be different on a bit level. The default value is stored in the system field @EPS and may be changed to another value.
ENABLE EXACT speeds up numerical testing by comparing, word by word, the actual physical words instead of their logical values. Note the results of the examples above. Before the EXACT option is enabled, the sum and 12.14 are declared equal within the specifications of system field @EPS. After EXACT is enabled, the sum and 12.14 are declared not equal due to an unavoidable hardware rounding error. The last bit of each value is actually different.
SEE ALSO: @EPS