11 - 145 11 - 145
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
MKD$
Function
MaKe Double $
• Converts a double-precision type numeric value into a character string.
MKD$ ( <double precision expression> [, S] )
Syntax
double precision expression
• • • •
Specify the double precision expression to be
converted into a character string.
Examples
C$=MKD$(3. 14159265389)
• • • •
Converts into an 8-byte character string and stores in
C$.
Description
• The MKD$ function converts a double-precision numeric value to an 8-byte character
string.
• Double-precision numeric values that will be written to the random file buffer using the
LSET or RSET instruction must be converted to a character string with the MKD$ function.
• The data converted into a character string by the MKD$ function can be restored to the
original numeric value only by the CVD function.
• It is recommended to use the LSET instruction when writing data that was converted to a
character string using the MKD$ function to the random file buffer.
If the field length (number of bytes) of each variable specified by the FIELD instruction is
greater than the used field length (number of bytes) of the MKD$ function, the data will not
be correctly converted by the CVD function.
Example
OPEN " : " AS #1
FIELD #1, 10 AS B$
A#=3.333333333333333
A$=MKD$(A#)
B$ P U U U U U U
B#=3.333333333333333
B#=CVD(C$)
C$= "PUUUUUU "
LSET B$=A$
LET C$=B$
(Correct)
C$= " PUUUUUU "
B#=9.473903143414155D-14
B#=CVD(C$)
LET C$=B$
RSET B$=A$
B$
P U U U U U U
Write
Write
Read
Read
File
(Incorrect)