Floating-point numbers description
Floating-point numbers have a length of 32 bits, and consist of the following three components:
Sign: determined by the signal state of bit 31. The bit 31 assume the value "0" (positive) or "1" (negative).
8-bit exponents to basis 2: the exponent is increased by a constant (base, +127), so that it has a value range of 0 to 255.
23-bit mantissa: only the fraction part of the mantissa is shown. The integer part of the mantissa is always 1 with normalized floating-point numbers and is not stored.
The following figure shows the structure of floating-point numbers:
|
Note
With floating-point numbers, only the precision defined by the IEEE754 standard is stored. Additionally specified decimals are rounded off according to IEEE754. The number of decimal places may decrease for frequently nested arithmetic calculations. If more decimal places are specified than can be stored by the data type, the number is rounded to the value corresponding to the precision allowed by this value range. |
The following table shows the properties of floating-point numbers:
|
Length (bit) |
Format |
Value range |
Examples of value input |
|---|---|---|---|
|
32 |
Floating-point numbers according to IEEE754 |
-3.402823e+38 to -1.175495e-38 ±0.0 +1.175495e-38 to +3.402823e+38 |
1.0e-5 |
|
Floating-point numbers |
1.0 |
|
Note
LOGO! 0BA8 and earlier versions only provide integer analog function blocks. You can use Float/Integer convertor FB or Integer/Float convertor FB to convert the integer and float data. These two blocks can only be used with the integer function blocks, and support single-precision floating-point number and double-precision floating-point number. LOGO! 9 and later versions provide float analog function blocks. Float analog blocks only support single-precision floating-point number. |
Floating-point numbers display
LOGO! supports the processing of floating-point numbers that comply with the IEEE754 standard.
This following table lists the display rules for floating-point numbers in LOGO!.
|
Value |
Display |
|---|---|
|
Invalid value |
NaN |
|
Positive infinity |
+INF |
|
Negative infinity |
-INF |
|
Valid value |
|
To learn more about the floating-point numbers format and display, refer to the IEEE754 standard.
|
Note
Float analog function blocks The output value of the float analog function blocks are floating-point numbers as shown in above table. When errors occur in the float blocks, the output value (usually AQ) will be kept as the value from the last cycle, and the float block parameters are unreliable. |