R_DI: Conversion real to double integer
The R_DI (FC379) block converts a real input to the next double integer value and issues it at the output.
Functionality
The block converts the input [In] to the next double integer value and issues it at the output [Out]. Rounding applies the following concept:
Positive input values:
- Round to the next higher integer if number after comma ≥ 0.5.
- Round to the next lower integer if number after comma < 0.5.
Negative input values:
- Round to the next higher integer if number after comma ≤ 0.5.
- Round to the next lower integer if number after comma > 0.5.
Examples:
In | Out |
> 2 147 483 647 * | 2 147 483 647 |
2 147 483 647 * | 2 147 483 647 |
10.0 | 10 |
9.6 | 10 |
9.5 | 10 |
9.499 | 9 |
-10.0 | -10 |
- 9.501 | -10 |
- 9.5 | - 9 |
- 9.4 | - 9 |
-2 147 483 648 * | -2 147 483 648 |
< -2 147 483 648 * | -2 147 483 648 |
* Inaccuracies in calculation within the framework of resolution for real numbers is ca. +/- 128.
Inputs
Pin | E | Description |
In | pa | Input |
Outputs
Pin | E | Description |
Out | a | Output |
Input values
Pin | Description | Data Type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
In | Input | Real | 0.0 |
|
|
|
Output values
Pin | Description | Data Type | Default value | E.g. Engineering unit or Text group | Min. | Max. |
Out | Output | Integer | 0 |
|
|
|
Process response
Standard (see General rules and information).
Troubleshooting
If the input value [In] is above the highest possible double integer value (2147483647) or below the lowest possible double integer value (-2147483648), it can no longer be displayed as a double integer value. For this reason, the highest possible or lowest possible double integer value is output at [Out].
Note that the resolution of the real number (24 bit mantissa => 8 digits) is limited and can thus not be displayed exactly by a number from 16 000 000.