Publication 1747-RM001G-EN-P - November 2008
4-26 Math Instructions
Updates to Arithmetic Status Bits
The arithmetic status bits are found in Word 0, bits 0 to 3 in the status file.
After an instruction is executed, the arithmetic status bits in the status file are
updated.
The above bits are cleared at the start of the CPT instruction. Status file bit
S:34/2 is for special handling of the math status bits when using floating point.
Application Example
This application example uses Pythagorean’s theorem to find the length of the
long leg of a triangle, knowing the two other leg lengths. Use the following
equation.
Table 4.16 Processor Function
With this Bit The Processor
S:0/0 Carry (C) sets based on the result of the last instruction in the Expression.
S:0/1 Overflow (V) sets any time an overflow occurs during the evaluation of the
Expression.
S:0/2 Zero (Z) sets based on the result of the last instruction in the Expression.
S:0/3 Sign (S) sets based on the result of the last instruction in the Expression.
c
2
a
2
b
2
+=
where c a
2
b
2
+()=
N10:0 N7:1()
2
N7:2()
2
+=