# - (Subtraction / Negation) ## Category Arithmetic ## Arity **Binary** — `left - right` (subtraction). **Unary** — `-value` (negation prefix). ``` - // binary: subtract - // unary: negate ``` ## Description Binary form: subtracts right operand from left operand. Returns the difference. Unary form: negates the operand (flips sign). Returns the negated value. Auto-unwraps `shared` values before operating. ## How It Works The host re-registers `-` with enhanced behavior that unwraps shared values. Both forms ultimately perform `double` arithmetic. The compiler distinguishes unary from binary form by operand count. Unary negation: `-5` → compiled as nular `5` then unary `-` opcode. ## Usage ### Binary subtraction ```sqf _result = 10 - 3; // 7 _damage = _incoming - _armor; _remaining = _max - _current; ``` ### Unary negation ```sqf _x = -5; // -5 _vel = -_speed; // negate variable _delta = -(_a - _b); // negate expression ``` ### With shared values ```sqf shared _count = 10; _new = get _count - 3; // auto-unwraps ``` ## Thread Safety Not atomic on shared values — use [sub](sub.md) for atomic decrement. Regular subtraction on primitives is thread-safe. ## See Also - [+](add-operator.md) — addition - [*](mul.md) — multiplication - [/](div.md) — division - [sub](sub.md) — atomic subtract for shared - [abs](abs.md) — absolute value