Syntax
Precision correction on comparison errors
TRUNC (R1*1000)
Meaning
TRUNC: Truncate decimal places
Relative quality of 10
-12
taken into account for
● Equality: (==)
● Inequality: (<>)
● Greater than or equal to: (>=)
● Less than or equal to: (<=)
● Greater/less than: (><) with absolute equality
● Greater than: (>)
● Less than: (<)
Compatibility
For compatibility reasons, the check for relative quality for (>) and (<) can be deactivated by
setting machine data MD10280 $MN_ PROG_FUNCTION_MASK Bit0 = 1.
Note
Comparisons with data of type REAL are subject to a certain imprecision for the above reasons.
If deviations are unacceptable, use INTEGER calculation by multiplying the operands by a
precision factor and then truncating with TRUNC.
Synchronized actions
The response described for the comparison commands also applies to synchronized actions.
Examples
Example 1: Precision considerations
Program code Comments
N40 R1=61.01 R2=61.02 R3=0.01 ;Assignment of initial values
N41 IF ABS(R2-R1) > R3 GOTOF ERROR ; Jump would have been executed up
until now
N42 M30 ; End of program
N43 ERROR: SETAL(66000)
R1=61.01 R2=61.02 R3=0.01 ;Assignment of initial values
Work preparation
3.1 Flexible NC programming
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0 445