{
  "capability_id": "math.subtraction",
  "tool_id": "subtraction",
  "engine": "subtraction",
  "calculation_version": "1.0.1",
  "generated_at": "2026-09-16T22:03:43.782Z",
  "engine_build": "2026-09-16",
  "test_count": 7,
  "passed": 7,
  "failed": 0,
  "tests_summary": {
    "golden": {
      "total": 6,
      "passed": 6
    },
    "boundary": {
      "total": 1,
      "passed": 1
    },
    "property": {
      "total": 0,
      "passed": 0
    }
  },
  "engine_tested": true,
  "expert_reviewed": false,
  "internally_reviewed": false,
  "review_kind": null,
  "source_checked": true,
  "reviewed_by": null,
  "reviewer_role": null,
  "last_reviewed": null,
  "expert_review": {
    "status": "optional_not_performed",
    "reviewer": null,
    "scope": [
      "formula",
      "input semantics",
      "assumptions",
      "limitations",
      "sources",
      "tests"
    ],
    "note": "Domain expert review is optional under CVP (CVP-EXP-01). Absence does not block CVP Verified. See Review policy for supplemental domain assurance."
  },
  "internal_review": {
    "status": "not_applicable",
    "reviewer": null
  },
  "page": "https://www.calculatorx.com/calc/math/subtraction",
  "api": "https://www.calculatorx.com/api/v1/calc/subtraction",
  "schema_input": "https://www.calculatorx.com/schemas/math.subtraction.input.json",
  "schema_output": "https://www.calculatorx.com/schemas/math.subtraction.output.json",
  "assumptions": [
    "Difference mode: finite reals; scientific notation allowed.",
    "Long subtraction: non-negative decimal numbers without scientific notation.",
    "Order is minuend − subtrahend. When minuend < subtrahend the difference is negative; long mode still stacks the minuend on top. Column work subtracts the smaller magnitude from the larger, then applies the sign."
  ],
  "limitations": [
    "Need any two of minuend/subtrahend/difference → MISSING_REQUIRED_INPUT",
    "Long mode: non-negative decimals; scientific notation not supported"
  ],
  "boundary_conditions": [
    "Exactly one blank among three fields when solving for a missing term",
    "Long mode rejects negatives and scientific notation",
    "Long mode does not require minuend ≥ subtrahend (45 − 123 = −78)"
  ],
  "sources": [
    {
      "title": "OpenStax Prealgebra 2e — Subtract Whole Numbers",
      "section": "1.3 Minuend − subtrahend = difference",
      "url": "https://openstax.org/books/prealgebra-2e/pages/1-3-subtract-whole-numbers",
      "supports": "Subtraction as taking away; place-value algorithm with regrouping.",
      "kind": "reference"
    },
    {
      "title": "CalculatorX mathematical conventions",
      "section": "Long subtraction with regrouping",
      "supports": "Column subtraction with borrowing; negative differences keep the minuend on top.",
      "kind": "definition"
    }
  ],
  "methods": [],
  "fingerprint": "sha256:113403a47c2ee55509526c0e98d7af7ababb1433c75c68e1b0fd4036154571ef",
  "tests": [
    {
      "id": "basic",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "difference",
        "a": 8,
        "b": 3
      },
      "expect": 5,
      "expectWarning": null,
      "actual": {
        "mode": "difference",
        "solve_for": "difference",
        "minuend": 8,
        "subtrahend": 3,
        "difference": 5,
        "value": 5,
        "formula": "a − b = d",
        "display": {
          "minuend": "8",
          "subtrahend": "3",
          "difference": "5",
          "value": "5"
        },
        "work": "Difference: 8 − 3 = 5\nCheck: 8 − 3 = 5",
        "swapped": false,
        "calculation_version": "1.0.1"
      },
      "tol": 0
    },
    {
      "id": "neg",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "difference",
        "a": 4,
        "b": -3
      },
      "expect": 7,
      "expectWarning": null,
      "actual": {
        "mode": "difference",
        "solve_for": "difference",
        "minuend": 4,
        "subtrahend": -3,
        "difference": 7,
        "value": 7,
        "formula": "a − b = d",
        "display": {
          "minuend": "4",
          "subtrahend": "-3",
          "difference": "7",
          "value": "7"
        },
        "work": "Difference: 4 − -3 = 7\nNote: subtracting a negative = adding: 4 + 3 = 7\nCheck: 4 − -3 = 7",
        "swapped": false,
        "calculation_version": "1.0.1"
      },
      "tol": 0
    },
    {
      "id": "decimal",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "difference",
        "a": 2.3,
        "b": 1.12
      },
      "expect": 1.18,
      "expectWarning": null,
      "actual": {
        "mode": "difference",
        "solve_for": "difference",
        "minuend": 2.3,
        "subtrahend": 1.12,
        "difference": 1.1799999999999997,
        "value": 1.1799999999999997,
        "formula": "a − b = d",
        "display": {
          "minuend": "2.3",
          "subtrahend": "1.12",
          "difference": "1.18",
          "value": "1.18"
        },
        "work": "Difference: 2.3 − 1.12 = 1.18\nCheck: 2.3 − 1.12 = 1.18",
        "swapped": false,
        "calculation_version": "1.0.1"
      },
      "tol": 1e-9
    },
    {
      "id": "regroup",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "difference",
        "minuend": 245,
        "subtrahend": 147
      },
      "expect": 98,
      "expectWarning": null,
      "actual": {
        "mode": "difference",
        "solve_for": "difference",
        "minuend": 245,
        "subtrahend": 147,
        "difference": 98,
        "value": 98,
        "formula": "a − b = d",
        "display": {
          "minuend": "245",
          "subtrahend": "147",
          "difference": "98",
          "value": "98"
        },
        "work": "Difference: 245 − 147 = 98\nCheck: 245 − 147 = 98",
        "swapped": false,
        "calculation_version": "1.0.1"
      },
      "tol": 0
    },
    {
      "id": "solve-minuend",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "difference",
        "subtrahend": 6,
        "difference": 9
      },
      "expect": {
        "solve_for": "minuend",
        "value": 15
      },
      "expectWarning": null,
      "actual": {
        "mode": "difference",
        "solve_for": "minuend",
        "minuend": 15,
        "subtrahend": 6,
        "difference": 9,
        "value": 15,
        "formula": "a − b = d",
        "display": {
          "minuend": "15",
          "subtrahend": "6",
          "difference": "9",
          "value": "15"
        },
        "work": "Solve minuend: d + b = 9 + 6 = 15\nCheck: 15 − 6 = 9",
        "swapped": false,
        "calculation_version": "1.0.1"
      },
      "tol": 0
    },
    {
      "id": "long-smaller-minuend",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "long",
        "minuend": "45",
        "subtrahend": "123"
      },
      "expect": {
        "difference": -78,
        "swapped": true
      },
      "expectWarning": null,
      "actual": {
        "mode": "long",
        "solve_for": "difference",
        "minuend": 45,
        "subtrahend": 123,
        "difference": -78,
        "value": -78,
        "formula": "a − b = d",
        "display": {
          "minuend": "45",
          "subtrahend": "123",
          "difference": "-78",
          "value": "-78"
        },
        "work": "Long subtraction (align place values, subtract right → left):\n\n     45\n− 123\n  -----\n    -78\n\nIf minuend < subtrahend, the result is negative. Column work subtracts the smaller magnitude from the larger, then applies the sign.\n\nColumn work (with regrouping / borrowing):\n  hundreds: 0 − 0 = 0\n  tens: 1 < 4 → borrow from hundreds; becomes 11, then 11 − 4 = 7\n  ones: 3 < 5 → borrow from tens; becomes 13, then 13 − 5 = 8",
        "steps": [
          {
            "column": "sign",
            "operation": "sign",
            "expression": "minuend < subtrahend → −(larger − smaller)",
            "result": -78
          },
          {
            "column": "ones",
            "operation": "borrow",
            "top": 3,
            "bottom": 5,
            "expression": "13 − 5",
            "result": 8,
            "borrow_from": "tens"
          },
          {
            "column": "tens",
            "operation": "borrow",
            "top": 1,
            "bottom": 4,
            "expression": "11 − 4",
            "result": 7,
            "borrow_from": "hundreds"
          },
          {
            "column": "hundreds",
            "operation": "subtract",
            "top": 0,
            "bottom": 0,
            "expression": "0 − 0",
            "result": 0
          }
        ],
        "swapped": true,
        "calculation_version": "1.0.1"
      },
      "tol": 0
    },
    {
      "id": "boundary-sub-one-term",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "minuend": 10
      },
      "expectError": "MISSING_REQUIRED_INPUT",
      "code": "MISSING_REQUIRED_INPUT",
      "error": "Enter any two of minuend, subtrahend, and difference."
    }
  ],
  "tier": "engine_tested",
  "verification": {
    "tests": {
      "passed": 7,
      "total": 7,
      "golden": 6,
      "boundary": 1,
      "property": 0
    },
    "contract_checks": {
      "passed": 1,
      "total": 1
    }
  },
  "evidence_core_generated_at": "2026-09-16T06:41:00.884Z",
  "rendered_at": "2026-09-16T22:03:43.782Z",
  "release_integrity": {
    "status": "verified",
    "scope": "workspace",
    "production_attestation_required": true,
    "calculation_version": "1.0.1",
    "artifacts": {
      "engine": "1.0.1",
      "page": "1.0.1",
      "capability": "1.0.1",
      "evidence": "1.0.1",
      "input_schema": "1.0.1",
      "output_schema": "1.0.1",
      "mcp_contract": "1.0.1"
    },
    "digests": {
      "input_schema_sha256": "fa1bc74e23719b3abe7bf9bddc9ffc8315a9561e8296e3016c65fb26dd15eca5",
      "output_schema_sha256": "59ae1ce074636bfab360e052486f3de9d0465dfea05d29061955df237fe7e6d8",
      "evidence_sha256": "a47f935193913f0199c2618c3cfc47c175a013a180b542b60fb0bfab824d2c47",
      "evidence_core_sha256": "a47f935193913f0199c2618c3cfc47c175a013a180b542b60fb0bfab824d2c47",
      "capability_sha256": "39c1c72ebd8730946c77bf8e5e80c036f241c835bc751af904352d49a477b495",
      "engine_sha256": "c8d4ccdbfeaf61d7b024d4e1babb0c2ba3b324c1b37bd0cb456a526d8d2b1bd1",
      "mcp_contract_sha256": "863098b311a7b17dc4b229a6302b90b3545b175f716e5d84772c7be8e9716b86"
    },
    "contract_checks": {
      "total": 1,
      "passed": 1,
      "failed": 0,
      "items": [
        {
          "id": "release-artifacts-aligned",
          "status": "pass",
          "detail": "1.0.1"
        }
      ]
    },
    "report": "https://www.calculatorx.com/.well-known/calculatorx-release-integrity.json"
  }
}
