[R_I] Conversion real to integer value

Function block R_I converts a real input to the next integer value and issues it at the output.

R_I converts a real input to the next integer value and issues it at the output.

Functioning

R_I 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 value if value after comma ≥ 0.5.
  • Round to the next lower integer value if value after comma <= 0.5.

Negative input values

  • Round to the next higher integer value if value after comma ≤ 0.5.
  • Round to the next lower integer value if value after comma > 0.5.

In

Out

> 32 767 1

32 767

32 767 1

32 767

10.0

10

9.5

10

9.499

9

-10.0

-10

- 9.501

-10

- 9.4

- 9

-32 768 1

-32 768

< -32 768 1

-32 768

1 Inaccuracies in calculation within the framework of resolution for real values is ca. +/- 128.

Pins

Input

Description

Data type

Default value
Value range

In

Input

Real

0.0

 

Output

Description

Data type

Default value
Value range

Out

Output

Integer

0

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].

info

Resolution of real values (24 bit => 8 digits) is limited. Thus, values from 16 000 000 cannot be displayed accurately.