Download Multichecker V2

Transcript
Multichecker A210/A110
Optional Memory
13.3
13.3.3
Numerical Calculation
Restrictions Applying to Numerical Calculations
Calculation Order
If a division is used in a calculation program, there is sometimes a remainder, and in that
case, the digits after the decimal point are discarded. This rounding−off is done not only
when all the calculations are finished, but also during the calculation, in accordance with
the priority order for arithmetical calculations. Therefore, if a division is to be carried out
in the course of calculation, try to put this program last if at all possible. Compare the
results of the two examples below.
Example:
1: CA05=CA01/2*100 (when CA01 = 3)
CA01/2 = 3/2 = 1.5
Since the decimal parts of numbers are discarded, 1.5
becomes 1.
CA01/2 × 100 = 1 × 100 = 100
Therefore the result of this calculation is CA05 = 100.
2: CA05=CA01*100/2 (when CA01 = 3)
CA01 × 100 = 3 × 100 = 300
CA01 × 100 / 2 = 300 / 2 = 150.
Therefore the result of this calculation is CA05 = 150.
Number of Digits in Numerical Calculations
Numerical calculations can operate on numbers in the range –2147483648 to
2147483647.
Constants can be specified in the range –65535 to 65535.
If an overflow (if the number exceeds the permissible range) occurs during calculation,
an error output is output from the parallel port at that point.
If the final result of numerical calculation is outside the range –2147483648 to
2147483647, then an error output is output from the parallel port.
In either of these cases the result of calculation is “0”.
If the results of calculation are output through the serial interface, they are output as the
error output “e”.
Division by Zero
If the denominator in a division is “0”, or if it references a value of “0”, then the output
of calculation is “0”, but an error output is output from the parallel port at the same time.
If the results of calculation are output through the serial interface, they are output as the
error output “e”.
Order of Use of CA Registers (numerical calculation registers)
If the result of a calculation in a CA register is to be used by another CA register, the
register being used needs to be set earlier than the register using it. (Calculations on
CA registers are carried out in ascending order of register number.)
13 − 19