Chapter 8 Logic Instructions
Real Number to Integer
Real numbers can be converted to integers. And some instructions are shown below.
For the real number-to-integer conversion, there are two cases in which the fractional part is
truncated and rounded up as follows.
Case 1: If the first digital number of the fractional part is less than 5, the fractional part will be
truncated and the integer part will not change.
Case 2: If the first digital number of the fractional part is greater than or equal to 5, the
fractional part will be truncated and the integer part will add by 1.
Input value
Case 1
1.36
-2.4
Case 2
1.6
-2.6
Note:
For the Real Number-to-Integer Conversion, there are two cases for the value of a real number.
1. If the number of input digits of a real number exceeds what is allowed, the result will be an
unsure value. Please set a limit in the user program in order to get a correct value.
For example: Then the input value is 123456789 and the number of its digits exceeds the
set limit 7. The digits which go beyond the limit are abnormal. Then the output value is
123456792.
2. If the number of input digits does not exceed the set limit, the result is calculated based on
the conversion rule.
Real Number to Bit string
Real numbers can be converted to bit strings. And some instructions are shown below.
8-169