{
  "schemaVersion": 1,
  "slug": "proportion-calculator",
  "category": "math",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "0e5df0b0ce33bd2893f051a98de1efe8c97a704c0397702675f17232ed6ca81b",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/proportion-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "d = b × c ÷ a (a : b = c : d)",
    "vars": [
      [
        "a",
        "Known term a"
      ],
      [
        "b",
        "Known term b"
      ],
      [
        "c",
        "Known term c"
      ],
      [
        "d",
        "Unknown term"
      ]
    ],
    "note": "For a:b = c:d, d = b×c÷a; zero divisors are rejected."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(a===0||b===0||c===0)return {__error:'inputError',d:null,ratioAB:null,ratioCD:null}; const d=a!==0?b*c/a:0; if(!Number.isFinite(d))return {__error:'inputError',d:null,ratioAB:null,ratioCD:null}; return {d,ratioAB:b!==0?a/b:0,ratioCD:d!==0?c/d:0};",
    "inputs": [
      {
        "name": "a",
        "type": "number",
        "default": 3,
        "min": -1000000000,
        "max": 1000000000,
        "step": 0.01
      },
      {
        "name": "b",
        "type": "number",
        "default": 4,
        "min": -1000000000,
        "max": 1000000000,
        "step": 0.01
      },
      {
        "name": "c",
        "type": "number",
        "default": 9,
        "min": -1000000000,
        "max": 1000000000,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "name": "d",
        "precision": 4,
        "unit": ""
      },
      {
        "name": "ratioAB",
        "precision": 6,
        "unit": ""
      },
      {
        "name": "ratioCD",
        "precision": 6,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
