4MELFA-BASIC IV
Logic numbers
4-144
4.4 Logic numbers
Logic numbers indicate the results of such things as comparison and input/output.
If not 0 when evaluated with an Integer, then it is true, and if 0, it is false. When substituted, if true, 1 is
assigned. The processes that can use logic numbers are shown in
.
Table 4-9:Values corresponding to true or false logic number
4.5 Functions
A function carries out a specific operation for an assigned argument, and returns the result as a numeric
value type or character string type. There are built-in functions, that are preassembled, and user-defined
functions, defined by the user.
(1) User-defined functions
The function is defined with the Def FN statement.
Example) Def FNMADD(MA, MB)=MA+MB
...........The function to obtain the total of two values is defined with FNMADD.
The function name starts with FN, and the data type identification character (C: character string, M: numeric
value, P: position, J: joint) is described at the third character. The function is designated with up to eight
characters.
(2) Built-in functions
A list of assembled functions is given in
.
Table 4-10:List of built-in functions
Items expressed with logic number "1"
Items expressed with logic number "0"
*Result of cmparison operation (if true)
*Result of logic operation (if true)
*Switch ON
*Input/output signal ON
*Hand open (supply current to the hand)
*Settings for enable/valid such as for interrupts
*Result of comparison operation (if false)
*Result of logic operation (if false)
*Switch OFF
*Input/output signal OFF
*Hand close (do not supply current to the hand)
*Settings for disable/invalid such as for interrupts
Class
Function name (format)
Functions
Page
Result
Numeric func-
tions
Abs (<Numeric expression>)
Produces the absolute value
Numeric
value
Cint (<Numeric expression>)
Rounds off the decimal value and converts into an integer.
Deg (<Numeric expression:radian>) Converts the angle unit from radian (rad) to degree (deg).
Exp (<Numeric expression>)
Calculates the value of the expression's exponential function
Fix (<Numeric expression>)
Produces an integer section
Int (<Numeric expression>)
Produces the largest integer that does not exceed the value in the
expression.
Len(<Character string expression>)
Produces the length of the character string.
Ln (<Numeric expression>)
Produces the logarithm.
Log (<Numeric expression>)
Produces the common logarithm.
Max (<Numeric expression>...)
Obtains the max. value from a random number of arguments.
Min (<Numeric expression>...)
Obtains the min. value from a random number of arguments.
Rad (<Numeric expression: deg.>)
Converts the angle unit from radian (rad) to degree (deg).
Sgn (<Numeric expression>)
Checks the sign of the number in the expression
Sqr (<Numeric expression>)
Calculates the square root
Strpos(<Character string expres-
sion>, <Character string expres-
sion>)
Obtains the 2nd argument character string position in the 1st argu-
ment character string.
Rnd (<Numeric expression>)
Produces the random numbers.
Asc(<Character string expression>)
Provides a character code for the first character of the character
string in the expression.
Cvi(<Character string expression>)
Converts a 2-byte character string into integers.
Cvs(<Character string expression>) Converts a 4-byte character string into a single-precision real number.
Cvd(<Character string expression>) Converts an 8-byte character string into a double-precision real number.
Val(<Character string expression>)
Converts a character string into a numeric value.
Trigonometric
functions
Atn(<Numeric expression>)
Calculates the arc tangent. Unit: radian
Definition range: Numeric value, Value range: -PI/2 to +PI/2
Numeric
value
Atn2(<Numeric expres-
sion>,<Numeric expression>)
Calculates the arc tangent. Unit: radian
THETA=Atn2(delta y, deltax)
Definition range: Numeric value of delta y or delta x that is not 0
Value range: -PI to +PI