4-135
Detailed specifications of MELFA-BASIC V
4MELFA-BASIC IV
4.3.16 Numeric value variables
Variables whose names begin with a character other than P, J, or C are considered numeric value variables.
In MELFA-BASIC
Ⅴ
, it is often specified that a variable is an numeric value variable by placing an M at the
head. M is the initial letter of mathematics.
Example) M1 = 100
M2! = -1.73E+10
M3# = 0.123
ABC = 1
1) It is possible to define the type of variable by attaching an numeric value type indicator at the end of
the variable name. If it is omitted, the variable type is assumed to be of the single-precision real num-
ber type.
2) Once the type of a variable is registered, it can only be converted from integer to single-precision real
number. For example, it is not possible to convert the type of a variable from integer to double-preci-
sion real number, or from single-precision real number to double-precision real number.
3) It is not possible to add an numeric value type indicator to an already registered variable. Include the
type indicator at the end of the variable name at the declaration when creating a new program.
4) If the value is exceeded during a single precision = double precision execution, an error will occur.
Table 4-5:Range of numeric value variable data
4.3.17 Character string variables
A character string variable should start with C and end with "$." If it is defined by the Def Char instruction, it
is possible to specify a name beginning with a character other than C.
Example) C1$ = "ABC"
CS$ = C1$
Def Char MOJI
MOJI = "MOJIMOJI"
4.3.18 Position variables
Variables whose names begin with character P are considered position variables. If it is defined by the Def
Pos instruction, it is possible to specify a name beginning with a character other than P. It is possible to ref-
erence individual coordinate data of position variables. In this case, add "." and the name of a coordinate
axis, e.g. "X," after the variable name.
P1.X, P1.Y, P1.Z, P1.A, P1.B P1.C, P1.L1, P1.L2
The unit of the angular coordinate axes A, B, and C is radians. Use the Deg function to convert it to degrees.
Example) P1 = PORG
Dim P3(10)
M1 = P1. X
(Unit : mm)
M2 = Deg(P1. A) (Unit : degree)
Deg POS L10
Mov L10
Numeric value type suffix
Meaning
%
Integer
!
Single-precsion real number type
#
Double-precsion real number type
Type
Range
Integer type
-32768 to 32767
Single-precision real number type -3.4038 to 3.4038
Note)
E expresses a power of 10.
Double-precision real number
type
-1.7976931348308 to 1.7976931348308