176
4 OPERATION CONTROL PROGRAMS
4.9 Type Conversions
Floating-point value conversion 64-bit into 32-bit: SFLT
■Usable Data
: Usable
■Description, data type of result
• The 64-bit floating-point (double precision real number) value stored in the device specified with (S) is converted into the
32-bit floating-point (single precision real number) value. Convertible data ranges are shown below.
-3.40 10
38
to -1.18 10
-38
, 0.0, 1.18 10
-38
to 3.40 10
38
(single precision real number)
• The 64-bit floating-point type is used as the data of floating-point type in the Motion SFC program. Use this instruction to
output the data into the external devices that cannot use the 64-bit floating-point type.
The number of effective digits of 32-bit floating-point value data is approx. 7 digits. Data in the seven digits or
later of conversion result by SFLT instruction may not match the (S) data.
An operation error will occur if:
• The (S) data is not a valid 64-bit floating-point type.
• The (S) data after convert is outside the range of 32 bit floating-point type.
■Program which converts the 64-bit floating-point value data of #0F into 32-bit floating-point
value data and substitutes the result to D2000L
Format Number of basic steps Usable steps
F/FS G
SFLT(S) 4
Setting
data
Usable Data
Bit
device
Word device Constant Calculation
expression
Bit
conditional
expression
Comparison
conditional
expression
16-bit
integer
type
32-bit
integer
type (L)
64-bit
floating
point
type (F)
16-bit
integer
type
(K/H)
32-bit
integer
type
(K/H, L)
64-bit
floating
point
type (K)
(S)
Setting data Description Data type of result
(S) Data which will be converted into 32-bit floating-point value 32-bit floating-point type
K-1.0
D2001 D2000
D2000L
#2 #1#3 #0
K-1.0
D2000L = SFLT(#0F)
#0F