11 - 48 11 - 48
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
DEFDBL
Instruction
DEFine DouBle
• Defines variables that start with a character of the specified range as the double precision
real number type.
Syntax
DEFDBL <alphabetical character> [- <alphabetical character> ] [, <alphabetical character>
[- <alphabetical character> ], …
Examples
DEFDBL A,C-E
• • • •
Defines variables starting with A and variables
starting with C, D, E as double precision real number
variables.
Description
• The DEFDBL instruction defines variables that start with a character of the specified range
as the double precision real number type. It defines the type of all variables starting with a
character specified by <alphabetical character> or with a character within the range
specified by <alphabetical character-alphabetical character> as double precision real
number type.
• Specification by the type declaration statement has priority for specifying the variable type,
and the result will be as follows:
Example
RUN
3.333333333333333 3 3.3333
OK
(Double precision)
(Integer)
(Single precision)
10 DEFDBLA
20 A=10/3
30 A%=10/3
40 A!=10/3
50 PRINT A, A%, A!
60 END
• Variables that were defined as double precision real number type by the DEFDBL
instruction and variables with the double precision type declaration character ‘#’ are
regarded as the same.
Example
RUN
1.666666666666667 • • •
OK
10 DEFDBLA
20 A=10/3 • • • Assigns
10/3=3.333 • • •
30 A#=5/3 • • • Assigns
5/3=1.666 • • •
40 PRINT A
50 END
Attempted to
display A, but
the value of A#
at line 30 is
displayed, i.e.,
A=A#.
• If the type is not declared by the DEFDBL instruction, a variable that has a variable name
without type declaration character is regarded as a single precision variable.
It is not permitted to spell as DEF DBL with a space between
DEF and DBL.
Be sure to spell DEFDBL in one word.
REMARK
See the DEFINT, DEFSNG and DEFSTR instructions, and Section 2.9.