Fanuc Series 15i/150i-MA (Programming) Operators Manual B-63324EN/03 PROGRAMMING 17.CUSTOM MACRO
- 619 -
Limitation
- Data type
The numeric data handled by custom macros are double-precision real
data, as laid down in the applicable IEEE standard. Any errors
associated with the execution of operations conform to the standard.
- Cautions on reduced precision
In addition or subtraction, if the absolute value is used as a subtrahend,
the relative error cannot be held within 10
-15
.
For example, let us assume that the actual values of #1 and #2 are as
follows in an operation. (These values are given only as examples. In
reality, they cannot be specified from a program.)
#1=9876543210.987654321
#2=9876543210.987657777
Operation #2 - #1 does not produce the following :
#2-#1=0.000003456
The reason for this is as follows : Custom macro variables are decimal
numbers with a precision of 15 digits. Thus, #1 and #2 can only be as
precise as the following :
#1 9876543210.123450000
#2 9876543210.123460000
(Strictly speaking, the internal values differ slightly from the above
values because they are binary.) Thus, the result will be
#2-1=0.000010000
This causes a large error.
- Relational operators
EQ, NE, GT, GE, and LE are basically the same as addition and
subtraction operators. Therefore, beware of errors. For example, in the
example above, the following cannot always determine whether #1 is
equal to #2, because of the possible error :
IF [#1 EQ #2]
It is necessary to allow for the possible error and determine that #1 is
equal to #2 if the difference is within the error, by using, for example,
the following :
IF [ABS [#1_#2]LT 0.1]
- Trigonometric functions
In the trigonometric functions, the absolute error is guaranteed.
Because, however, the relative error cannot be held within 10
-15
,
multiplication and division must be used with care after trigonometric
function operations.
- FIX function
Pay careful attention to the precision when applying the FIX function
to the result of an operation.
For example, #3 will not necessary be equal to 2 if the following are
performed :
N10 #1=0.002 ;
N20 #2=#1*1000 ;
N30 #3=FIX[#2] ;
The reason for this is that, because of the possible error in the operation
of N20, #2 may not be equal to 