Integer to REAL

The controller stores REAL values in IEEE single-precision, floating-point number format. It uses one bit for the sign of the value, 23 bits for the base value, and eight bits for the exponent (32 bits total). If you mix an integer tag (SINT, INT, or DINT) and a REAL tag as inputs in the same instruction, the controller converts the integer value to a REAL value before the instruction executes.
A SINT or INT value always converts to the same REAL value.
A DINT value may not convert to the same REAL value:
  • A REAL value uses up to 24 bits for the base value (23 stored bits plus a "hidden" bit).
  • A DINT value uses up to 32 bits for the value (one for the sign and 31 for the value).
  • If the DINT value requires more than 24 significant bits, it may not convert to the same REAL value. If it will not, the controller rounds to the nearest REAL value using 24 significant bits.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.