Real To An Integer - Allen-Bradley Logix5000 Reference Manual

1756 controllogix, 1768 compactlogix, 1769 compactlogix, 1789 softlogix, 1794 flexlogix, powerflex 700s with drivelogix
Hide thumbs Also See for Logix5000:
Table of Contents

Advertisement

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.
EXAMPLE
This REAL value
-2.5
-1.6
-1.5
-1.4
1.4
1.5
1.6
2.5
EXAMPLE
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Conversion of REAL values to DINT values
Converts to this DINT value
-2
-2
-2
-1
1
2
2
2
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.
Common Attributes
Appendix A
653

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents