5.1 Type Conversion Functions
5.1.29 String type
→
single-precision real type conversion
5-91
5
APPLICATION
FUNCTIONS
STR_TO_REAL(_E)
STR_TO_REAL(_E)
Operation Error
An operation error occurs in the following cases.
• Any characters other than 30
H to 39H exist in the integral or decimal part.
(Error code: 4100)
• Two or more 2EH exist. (Error code: 4100)
• Any characters other than '45
H(E), 2CH(+)' or '45H(E), 2DH(−)' exist in the exponent part,
or more than one exponential parts exist. (Error code: 4100)
• The data after conversion is 0 or outside the range of ±1.17549
-38
to ±3.40282
+38
(Error code: 4100)
• The number of characters is 0 or exceeding 24. (Error code: 4100)
Program Example
The program which converts string type data input to into single-precision real type data, and
outputs the operation result from .
(a) Function without EN/ENO (STR_TO_REAL)
[Structured ladder]
[ST]
g_real1 := STR_TO_REAL (g_string1);
(b) Function with EN/ENO (STR_TO_REAL_E)
[Structured ladder]
[ST]
g_bool3 := STR_TO_REAL_E (g_bool1, g_string1, g_real1);
s
d