Subtract¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
x - y or Subtract[x, y] represents x - y; rewritten by the evaluator
to Plus[x, Times[-1, y]] so it inherits Plus's flattening and ordering.
Examples¶
No verified examples yet for this function.
Implementation notes¶
builtin_subtract is a thin two-argument rewrite: a - b becomes Plus[a, Times[-1, b]]. It does no arithmetic itself — the returned Plus/Times tree is canonicalised and folded by the evaluator's Plus/Times machinery. Non-binary calls return NULL.
Attributes: Listable, NumericFunction, Protected.
Implementation status¶
Stable — documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
References¶
- Source:
src/arithmetic.c - Specification:
docs/spec/builtins/arithmetic.md
Notes & additional examples¶
Worked examples¶
Notes¶
x - y is rewritten to Plus[x, Times[-1, y]], so subtraction inherits Plus's flattening and canonical ordering rather than existing as a distinct head in the result.