Fanuc Series 15i/150i-MA (Programming) Operators Manual 17.CUSTOM MACRO PROGRAMMING B-63324EN/03
- 618 -
- Rounding up and down to an integer
With CNC, when the absolute value of the integer produced by an
operation on a number is greater than the absolute value of the original
number, such an operation is referred to as rounding up to an integer.
Conversely, when the absolute value of the integer produced by an
operation on a number is less than the absolute value of the original
number, such an operation is referred to as rounding down to an integer.
Be particularly careful when handling negative numbers.
[Example]
Suppose that #1=1.2 and #2=-1.2.
When #3=FUP[#1] is executed, 2.0 is assigned to #3.
When #3=FIX[#1] is executed, 1.0 is assigned to #3.
When #3=FUP[#2] is executed, -2.0 is assigned to #3.
When #3=FIX[#2] is executed, -1.0 is assigned to #3.
- Abbreviations of arithmetic and logic operation commands
When a function is specified in a program, the first two characters of
the function name can be used to specify the function.
[Example] ROUND RO
FIX FI
- Priority of operations
(1)Functions
(2)Operations such as multiplication and division (*, /, AND)
(3)Operations such as addition and subtraction (+, -, OR, XOR)
- Bracket nesting
Brackets are used to change the order of operations. Brackets can be
used to a depth of five levels including the brackets used to enclose a
function. When a depth of five levels is exceeded, P/S alarm No. 118
occurs.
Example) #1=#2+#3*SIN[#4];
(1), (2) and (3) indicate the order of operations.
(1)
(2)
(3)
Example) #1=SIN [ [ [#2+#3] *#4 +#5] *#6] ;
(1)to(5) indicate the order of operations.
(1)
(2)
(3)
(4)
(5) 