Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 122

Chapter
Expressions, Variables and Operators
9
9 -12
INT
Use the INT operator to return the integer portion of the expression.
>PRINT INT(3.7)
Result:
3
>PRINT INT(100.876)
Result:
100
PI
PI is a stored constant. In the BASIC module PI is stored as 3.1415926.
SGN
Use the SGN (sign) operator to return a value of +1 if the argument is
greater than zero, 0 if the argument is equal to zero, and -1 if the argument
is less than zero.
>PRINT SGN(52)
Result:
1
>PRINT SGN(0)
Result:
0
>PRINT SGN(-8)
Result:
-1
SQR
Use the SQR operator to return the square root of the argument.
The argument may not be less than zero.
>PRINT SQR(9)
Result:
3
>PRINT SQR(45)
Result:
6.7082035
>PRINT SQR(100)
Result:
10
RND
Use the RND operator to return a pseudo-random number in the range
between 0 and 1 inclusive. The RND operator uses a 16-bit binary seed (a
constantly changing number used as a starting number for the RND
calculation) and generates 65536 pseudo-random numbers before repeating
the sequence. The RND operator uses the same calculations to arrive at
each number, but uses a different seed each time. The numbers generated
are between 0/65535 and 65535/65535 inclusive (ex. 0.1, 0.00009,
0.345689).
>PRINT RND
Result:
.26771954