11 - 52 11 - 52
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
DEFSNG
Instruction
DEFine SiNGle
• Defines variables that start with a character of the specified range as the single precision
real number type.
Syntax
DEFSNG <alphabetical character> [- <alphabetical character> ] [, <alphabetical
character> [- <alphabetical character> ], …
Examples
DEFSNG C, X-Z
• • • •
Defines variables starting with C and variables
starting with X, Y, Z as single precision real number
type variables.
Description
• The DEFSNG instruction defines variables that start with a character of the specified range
as the single 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 the single 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.3333 3 3.333333333333333
(Single precision)
(Integer)
(Double precision)
10 DEFSNG A
20 A=10/3
30 A%=10/3
40 A#=10/3
50 PRINT A, A%, A#
60 END
OK
• Variables defined as single precision real number type by the DEFSNG instruction and
variables with the single precision real number type declaration character ‘!’ are regarded
as the same.
Example
RUN
1.6666
OK
10 DEFSNG A
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! in line 30
is displayed, i.e., A=A!.
It is not permitted to spell as DEF SNG with a space between
DEF and SNG.
Be sure to spell DEFSNG in one word.
REMARK
See the DEFDBL, DEFINT and DEFSTR instructions, and Section 2.9.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...