Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 653
Common Attributes Appendix A
REAL to an Integer
To convert a REAL value to an integer value, the controller rounds the fractional
part and truncates the upper portion of the non-fractional part. If data is lost, the
controller sets the overflow status flag. Numbers round as in the following
examples.
• Numbers other than x.5 round to the nearest whole number.
• X.5 rounds to the nearest even number.
The following example shows the result of converting REAL values to DINT
values.
Conversion of REAL values to DINT values
The arithmetic status flags are set based on the value being
stored. Instructions that normally do not affect arithmetic
status keywords might appear to do so if type conversion
occurs because of mixed data types for the instruction
parameters. The type conversion process sets the arithmetic
status keywords.
This REAL value Converts to this DINT value
-2.5 -2
-1.6 -2
-1.5 -2
-1.4 -1
1.4 1
1.5 2
1.6 2
2.5 2