
15.
CUSTOM MACRO
15.2
Creation of Custom Macro Body
Operation format
Average error Maximum error
Type of error
a = b*c
1.55 x
lo-‘0
4.66 x
lo-‘0
Relative error
a =
b/c
4.66 x IO-10 1.86 x
10-g
8
a= b
1.24x
IO-‘0
1
3.73 x
10-s
H
a
a
=b+c
a
=b-c
I
2.33 x
lo-10
a
= SIN b
b =
COSb
5.0 x
10-g
1.0 x 10-e
Absolute error
,
1~1
degrees
a
=
ATAN
b/c
1.8 x
10-s
3.6 x
10-s
(Note)
(8)
(a)
(b)
(cl
e.
(d)
Function TAN performs
SINEOS.
Notes on decreased precision
Addition and subtraction
Note that when absolute values are used subtractively in addition or subtraction,
the relative error cannot be held under 10-k For example, suppose that the
real
values of
#1
and
#2
are as follows.
#I
= 9876543210123.456
#2=
9876543277777.777
Performing operation
#2
-
#I
does not produce
#2
-
#l
= 67654.321,
since the custom macro has a precision of only eight decimal digits, the values
of
#l
and
#2
have a precision as low as approximately
#l
= 9876543200000.000
#2 = 9876543300000.000,
respectively. (The internal values differ somewhat from the above values
because they are binary numbers.)
Consequently,
#2
-
#l
= 100000.000
which generates a large error.
Logical operation
EQ, NE, GT, LT, GE and LE are basically the same as addition and
subtraction. Therefore, be careful of errors. To determine whether or not
#l
and
#2
are equal in the above, for example,
IF
[#l
EQ #2]
is not always evaluated correctly. When the error is
evaluated as in
IF
[ABS
[#l
-
#2]
LT
5OOOOj
and the difference between
#1
and
#2
falls within the range error, both values
must be considered equal.
Trigonometric functions
Absolute errors occur in trigonometric functions; but,
since they are not under
3
O-s,
be careful of integration or division after using a trigonometric function.
FIX function
Th;e
user needs to be always careful about precision also when using the FIX
function for the results of an operation.