374
MACROS
96-8000
June 1999
Notes on Functions
The function ROUND works differently depending on the context that it is used. When used in arithmetic
expressions, the round function works as one would expect. That is, any number with a fractional part greater
than or equal to .5 is rounded up to the next whole integer; otherwise, the fractional part is truncated from the
number.
#1= 1.714 ;
#2= ROUND[#1] ; (#2 is set to 2.0)
#1= 3.1416 ;
#2= ROUND[#1] ; (#2 is set to 3.0)
When round is used in an address expression, then the argument of round is rounded to the addresses signifi-
cant precision. For metric and angle dimensions, three-place precision is the default. For inch, four-place
precision is the default. Integral addresses such as D, T and H are rounded normally.
#1= 1.00333 ;
G0 X[ #1 + #1 ] ;
(Table moves to 2.0067) ;
G0 X[ ROUND[ #1 ] + ROUND[ #1 ] ] ;
(Table moves to 2.0066) ;
G0 A[ #1 + #1 ] ;
(Axis moves to 2.007) ;
G0 A[ ROUND[ #1 ] + ROUND[ #1 ] ] ;
(Axis moves to 2.006) ;
D[1.67] (Diameter 2 is made current) ;
Operators
Operators can be classified into three categories: Arithmetic operators, Logical operators and Boolean opera-
tors.
Arithmetic Operators
Arithmetic operators consist of the usual unary and binary operators. They are:
+ - Unary plus +1.23
- - Unary minus -[COS[30]]
+ - Binary addition#1=#1+5
- - Binary subtraction #1=#1-1
* - Multiplication #1=#2*#3
/ - Division #1=#2/4
MOD - Remainder #1=27 MOD 20
(#1 contains 7)