2-155
2 Instruction Descriptions
NJ-series Instructions Reference Manual (W502)
Math Instructions
2
AddOU (+OU)
The functions of the AddOU instruction and the +OU instruction are exactly the same. Use the form that
is easier to use.
• When you calculate real numbers, use the CheckReal instruction (page 2-209) to see if Out is posi-
tive infinity, negative infinity, or nonnumeric data.
• Use the ADD (+) instruction (page 2-152) if there is no need for an overflow/underflow check. It will
reduce processing time.
• Set the data type of Out to include the valid ranges of In1 to InN.
• If In1 to InN and Out are integers, make sure the addition result will fit in the valid range of Out. Oth-
erwise, the value of Out will be an illegal value. An error will not occur.
• If the data types of In1 to InN are different, calculations and processing of P_CY are performed with
the data type that includes all of the data types of In1 to InN. For example, if In1 is INT data and In2 is
DINT data, calculations and P_CY processing are performed with DINT data.
• If In1 to InN contains real data, the value of P_CY does not change.
• Addition results of positive or negative infinity are handled as follows for real number values.
• If any of the values of In1 to InN is nonnumeric data, the value of Out is nonnumeric data.
• If the value of Out is positive infinity, negative infinity, or nonnumeric data, the value of P_CY does not
change.
• You can add real numbers and integers. If you do, Out is a real number.
Related System-defined Variables
Name Meaning Data type Description
P_CY Carry (CY) Flag BOOL TRUE: There is an overflow or underflow.
FALSE: There is no overflow or underflow.
Additional Information
Precautions for Correct Use
Addition Addition result
+∞ plus number +∞
−∞
plus number −∞
+∞
plus +∞ +∞
−∞
plus −∞ −∞
+∞
plus −∞
Nonnumeric
data
abc:=AddOU(INT#32767, INT#1);
LD ST
abc
INT#32767
INT#1
AddOU
EN ENO
In1
In2