#### Synopsis

Return the sum of the arguments

#### Stack Diagram

Input Stack Output Stack
Num1 Num2 Num3
Num1 Z2 Z3
Num1 2 3
Num1 A2 'Num1 + A2'
Z1 Z2 Z3
Z1 Num2 Z3
Z1 2 Z3
Z1 A2 'Z1 + A2'
1 2 3
1 Num2 3
1 Z2 Z3
1 A2 '∡1 + A2'
A1 A2 'A1 + A2'
A1 Num2 'A1 + Num2'
A1 Z2 'A1 + Z2'
A1 U2 'A1 + U2'
A1 2 'A1 + ∡2'
U1 U2 U3
U1 A2 'U1 + A2'
M1 M2 M3
V1 V2 V3
S1 S2 “S1S2
S1 O2 “S1O2
O1 S2 “O1S2
Level 2 / Argument 1 Level 1 / Argument 2 Level 1

 Type Operator Parallel list processing Group 6 Affected by flags -20 Underflow exception -21 Overflow exception -22 Infinite result exception -23 Negative underflow indicator -24 Positive underflow indicator -25 Overflow indicator -26 Infinite result indicator

#### Description

In general if the arguments of the sum have the same type so will do the result. However same data types may have different sub-types; in this case the following coercion rules apply:

1. the sub-type of the first argument determines the sub-type of the result: e.g. the sum between an hexadecimal and an octal integer will be hexadecimal, the sum between an angle in radians and an angle in degrees will be in radians, and so on;
2. if the imaginary part of the sum between a complex number and a scalar is 0 the result will be coerced to real type;
3. if the sum between two binary numbers overflows the range of binary sub-type the result will be coerced to real type;
4. the sum between two unit objects is possible only if the two are dimensionally coherent;
5. the sum between two matrices is possible only if they have the same dimension;
6. the sum between two vectors is possible only if they have the same dimension.

If the arguments of the sum have different type the following rules apply:

1. the sum between an angle and a real number will interpret the real number as an angle given in the current angle mode. The result will be an angle expressed in the system of the first argument (current mode if the first argument is the real number);
2. the sum between a complex and a real number will result in a complex number, except when the imaginary part of the result is 0: in this case the result will be coerced to real type;
3. the sum between an angle and a complex number will convert the angle to a real number expressing the angle in radians. Subsequently the real number will be added to the complex number according to the rule above;
4. when adding two binary integers the binary wordsize is NOT taken into account. Use BADD if truncation to wordsize is desired;
5. dimensionless units are coherent with scalars and angles therefore they can be added.

The sum between two matrices or two vectors is done element by element: for each couple of elements the rules above are applied.

Occurrence of underflow, overflow or infinite result will raise an error if one of the corresponding flags from -20 to -22 is cleared.

If on the contrary one or more of these flags is set, no error will be raised and the matching indicator flag from -23 to -26 will be set.

#### Compatibility

This command is only partially compatible with userRPL.

In particular:

• coercion rules give precedence to first argument rather than the second;
• the + operator does not concatenate or extend lists anymore: use ADD instead.

#### Usage

2:                         #120o
1:                           #3h
……………………………………………………………………………………
+

returns #123o.

2:                     (1, ∡60°)
1:                             5
……………………………………………………………………………………
+

returns (5.5678., ∡8.9483.°).

2:                      "Hello "
1:                      "world!"
……………………………………………………………………………………
+

returns “Hello world!”.

2:                           1_h
1:                        36_min
……………………………………………………………………………………
+

returns 1.6_h.

2:                       [ 1 2 ]
1:                       [ 1 0 ]
……………………………………………………………………………………
+

returns [ 2 2 ].

2:                           'X'
1:                           'Y'
……………………………………………………………………………………
+

returns 'X+Y'.

#### Related Commands

Operator Short Description
Evaluation operators:
EVAL1 Evaluate one level NEW
EVAL Evaluate full depth
XEQ Execute NEW
→NUM Compute numeric result
Test operators:
== Equality test
Not equal test
< Less than test
Less than or equal test
> Greater than test
Greater than or equal test
CMP Comparison test (<0 if A<B, 0 if A==B, >0 if A>B) NEW
SAME Comparison test, true if objects are the same
ISTRUE True test NEW
Logical operators:
AND Logical AND
OR Logical OR
XOR Logical XOR
NOT Logical NOT
Mathematic operators: