13. Program Support Functions
13.5 User Macro Specifications
357
Arithmetic accuracy
As shown in the following table, errors will be generated when performing arithmetic operations
once and these errors will accumulate by repeating the operations.
Arithmetic format
Average error
Maximum error
Type of error
a = b + c
a = b
−
c
2.33
×
10
−
10
5.32
×
10
−
10
Min.
|
ε
/b|, |
ε
/c|
a = b
∗
c 1.55
×
10
−
10
4.66
×
10
−
10
a = b/c
4.66
×
10
−
10
1.86
×
10
−
9
a = b
1.24
×
10
−
9
3.73
×
10
−
9
Relative error
|
ε
/a|
a = SIN [b]
a = COS [b]
5.0
×
10
−
9
1.0
×
10
−
8
a = ATAN [b/c]
1.8
×
10
−
6
3.6
×
10
−
6
Absolute error
|
ε
|
°
(Note)
SIN/COS is calculated for the function TAN.
Notes on reduced accuracy
(1) Addition and subtraction
It should be noted that when absolute values are used subtractively in addition or subtraction,
the relative error cannot be kept below 10
−
8
.
For instance, it is assumed that the real values produced as the arithmetic calculation result of
#10 and #20 are as follows (these values cannot be substituted directly) :
#10 = 2345678988888.888
#20 = 2345678901234.567
Performing #10
−
#20 will not produced #10
−
320 = 87654.321. There are 8 significant digits
in the variables and so the values of #10 and #20 will be as follows (strictly speaking, the
internal values will differ somewhat from the values below because they are binary numbers) :
#10 = 2345679000000.000
#20 = 2345678900000.000
Consequently, #10
−
#20 = 100000.000 will generate a large error.
(2) Logical
operations
EQ, NE, GT, LT, GE and LE are basically the same as addition and subtraction and so care
should be taken with errors. For instance, to determine whether or not #10 and #20 are equal
in the above example :
IF [#10EQ#20]
It is not always possible to provide proper evaluation because of the above mentioned error.
Therefore, when the error is evaluated as in the following expression :
IF [ABS [#10
−
#20] LT200000]
and the difference between #10 and #20 falls within the designated range error, both values
should be considered equal.
(3) Trigonometric
functions
Absolute errors are guaranteed with trigonometric functions but since the relative error is not
under 10
−
8
, care should be taken when dividing or multiplying after having used a trigonometric
function.