R_I: Conversion real to integer
The R_I (FC378) block converts a real input to the next integer value and issues it at the output.
Functionality
The block converts the input [In] to the next 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 |
> 32 767 * | 32 767 |
32 767 * | 32 767 |
10.0 | 10 |
9.6 | 10 |
9.5 | 10 |
9.499 | 9 |
-10.0 | -10 |
- 9.501 | -10 |
- 9.5 | - 9 |
- 9.4 | - 9 |
-32 768 * | -32 768 |
< -32 768 * | -32 768 |
* 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 integer value (32,767) or below the lowest possible integer value (-32,768), it can no longer be displayed as an integer value. For this reason, the highest possible or lowest possible 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.