{
  "capability_id": "math.modulo",
  "tool_id": "modulo",
  "engine": "modulo",
  "calculation_version": "1.1.0",
  "generated_at": "2026-09-19T02:14:29.317Z",
  "engine_build": "2026-09-19",
  "test_count": 13,
  "passed": 13,
  "failed": 0,
  "tests_summary": {
    "golden": {
      "total": 3,
      "passed": 3
    },
    "boundary": {
      "total": 4,
      "passed": 4
    },
    "property": {
      "total": 6,
      "passed": 6
    }
  },
  "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/modulo",
  "api": "https://www.calculatorx.com/api/v1/calc/modulo",
  "schema_input": "https://www.calculatorx.com/schemas/math.modulo.input.json",
  "schema_output": "https://www.calculatorx.com/schemas/math.modulo.output.json",
  "assumptions": [
    "Euclidean remainder",
    "Not JavaScript truncated %",
    "Integers only"
  ],
  "limitations": [
    "Euclidean remainder, not truncated or floored remainder toward −∞ of the quotient only",
    "Not IEEE remainder or floating-point fmod",
    "Not /calc/math/gcf — gcd is only used for invertibility",
    "modulus = 0 → DIVISION_BY_ZERO",
    "gcd(a,m) ≠ 1 → NOT_INVERTIBLE",
    "|m| < 2 on inverse → INVALID_INPUT",
    "Share URLs use modulus, not m (m is reserved elsewhere)"
  ],
  "boundary_conditions": [
    "missing a or modulus → MISSING_REQUIRED_INPUT",
    "modulus = 0 → DIVISION_BY_ZERO"
  ],
  "sources": [
    "ISO 80000-2:2019 Quantities and units — Mathematics (integer division / remainder)",
    "Knuth, The Art of Computer Programming, Euclidean division (remainder ≥ 0)"
  ],
  "methods": [],
  "fingerprint": "sha256:59e9e5e8c8611060a80fa798580aed8925a9c0cbb6da559c0932d9eec2e80b76",
  "tests": [
    {
      "id": "golden-mod",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "a": 17,
        "modulus": 5
      },
      "expect": {
        "remainder": 2,
        "quotient": 3
      },
      "expectWarning": null,
      "actual": {
        "mode": "remainder",
        "a": 17,
        "modulus": 5,
        "remainder": 2,
        "quotient": 3,
        "identity": "17 = (3)·(5) + 2",
        "convention": "euclidean",
        "algorithm": "euclidean_division",
        "formula": "a = q·m + r,  0 ≤ r < |m|",
        "numeric_domain": "integer",
        "exactness": "exact",
        "numeric_backend": "bigint"
      },
      "tol": null
    },
    {
      "id": "golden-mod-negative",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "a": -17,
        "modulus": 5
      },
      "expect": {
        "remainder": 3,
        "quotient": -4
      },
      "expectWarning": null,
      "actual": {
        "mode": "remainder",
        "a": -17,
        "modulus": 5,
        "remainder": 3,
        "quotient": -4,
        "identity": "-17 = (-4)·(5) + 3",
        "convention": "euclidean",
        "algorithm": "euclidean_division",
        "formula": "a = q·m + r,  0 ≤ r < |m|",
        "numeric_domain": "integer",
        "exactness": "exact",
        "numeric_backend": "bigint"
      },
      "tol": null
    },
    {
      "id": "boundary-mod-zero",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "a": 10,
        "modulus": 0
      },
      "expectError": "DIVISION_BY_ZERO",
      "code": "DIVISION_BY_ZERO",
      "error": "modulus must be non-zero."
    },
    {
      "id": "boundary-mod-missing",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "a": 10
      },
      "expectError": "MISSING_REQUIRED_INPUT",
      "code": "MISSING_REQUIRED_INPUT",
      "error": "Enter an integer modulus."
    },
    {
      "id": "golden-mod-inverse",
      "ok": true,
      "kind": "golden",
      "inputs": {
        "mode": "inverse",
        "a": 3,
        "modulus": 11
      },
      "expect": {
        "inverse": 4,
        "gcd": 1
      },
      "expectWarning": null,
      "actual": {
        "mode": "inverse",
        "a": 3,
        "modulus": 11,
        "remainder": 3,
        "inverse": 4,
        "gcd": 1,
        "bezout_x": 4,
        "bezout_y": -1,
        "invertible": true,
        "identity": "3·4 ≡ 1 (mod 11)",
        "convention": "euclidean",
        "algorithm": "extended_euclidean",
        "formula": "ax ≡ 1 (mod m)",
        "numeric_domain": "integer",
        "exactness": "exact",
        "numeric_backend": "bigint"
      },
      "tol": null
    },
    {
      "id": "boundary-mod-not-invertible",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "inverse",
        "a": 2,
        "modulus": 4
      },
      "expectError": "NOT_INVERTIBLE",
      "code": "NOT_INVERTIBLE",
      "error": "a and modulus are not coprime (gcd=2); no modular inverse."
    },
    {
      "id": "boundary-mod-inverse-mode",
      "ok": true,
      "kind": "boundary",
      "inputs": {
        "mode": "gcd",
        "a": 3,
        "modulus": 11
      },
      "expectError": "INVALID_MODE",
      "code": "INVALID_MODE",
      "error": "mode must be remainder or inverse."
    },
    {
      "id": "property-mod-pos",
      "ok": true,
      "kind": "property",
      "detail": "17 = 3·5 + 2",
      "expect": 2,
      "actual": 2
    },
    {
      "id": "property-mod-neg",
      "ok": true,
      "kind": "property",
      "detail": "−17 = (−4)·5 + 3",
      "expect": 3,
      "actual": 3
    },
    {
      "id": "property-mod-range",
      "ok": true,
      "kind": "property",
      "detail": "0 ≤ r < |m|",
      "expect": true,
      "actual": 3
    },
    {
      "id": "property-mod-identity",
      "ok": true,
      "kind": "property",
      "detail": "a = q·m + r",
      "expect": -17,
      "actual": -17
    },
    {
      "id": "property-mod-neg-m",
      "ok": true,
      "kind": "property",
      "detail": "r still in [0,|m|)",
      "expect": 2,
      "actual": 2
    },
    {
      "id": "property-mod-inv",
      "ok": true,
      "kind": "property",
      "detail": "3⁻¹ ≡ 4 (mod 11)",
      "expect": 4,
      "actual": 4
    }
  ],
  "tier": "engine_tested",
  "verification": {
    "tests": {
      "passed": 13,
      "total": 13,
      "golden": 3,
      "boundary": 4,
      "property": 6
    },
    "contract_checks": {
      "passed": 4,
      "total": 4
    }
  },
  "evidence_core_generated_at": "2026-09-19T01:08:38.526Z",
  "rendered_at": "2026-09-19T02:14:29.317Z",
  "release_integrity": {
    "status": "verified",
    "scope": "workspace",
    "production_attestation_required": true,
    "calculation_version": "1.1.0",
    "artifacts": {
      "engine": "1.1.0",
      "page": "1.1.0",
      "capability": "1.1.0",
      "evidence": "1.1.0",
      "input_schema": "1.1.0",
      "output_schema": "1.1.0",
      "mcp_contract": "1.1.0"
    },
    "digests": {
      "input_schema_sha256": "dcbee42ab4691d7298144d98af2f0d064a63300f13d6e34f83e69ce5e0aed01e",
      "output_schema_sha256": "803b6d51a579dee4e63148f96a4901e06725aaf252b9ac093bb412499fe6502a",
      "evidence_sha256": "de5a14b51bb76640c3a503f9989febd2ccb538656288676c0ea7916fb0398c6f",
      "evidence_core_sha256": "de5a14b51bb76640c3a503f9989febd2ccb538656288676c0ea7916fb0398c6f",
      "capability_sha256": "818d17968f8510389f876667c04293f35abb0b29105cc3d159b6ddf7104d113e",
      "engine_sha256": "e2db0a7325e87d733eee5491a146d870677fe7b2ccb5d15ba36a8b5afbb17247",
      "mcp_contract_sha256": "312c860acede70764ad49c5e6180292fe8086ed8874884b9239465a80766d858"
    },
    "contract_checks": {
      "total": 4,
      "passed": 4,
      "failed": 0,
      "items": [
        {
          "id": "release-artifacts-aligned",
          "status": "pass",
          "detail": "1.1.0"
        },
        {
          "id": "schema-valid-input-executes",
          "status": "pass"
        },
        {
          "id": "engine-success-output-validates-schema",
          "status": "pass"
        },
        {
          "id": "schema-rejects-incomplete-input",
          "status": "pass"
        }
      ]
    },
    "report": "https://www.calculatorx.com/.well-known/calculatorx-release-integrity.json"
  }
}
