{
  "schemaVersion": 1,
  "slug": "tire-size-calculator",
  "category": "automotive",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "b0335841f50643e760453b06e8a066b597c2afe3db8bdfe613d5d8742296cdb5",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/tire-size-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 = R + 2 × W × (a ÷ 100) ÷ 25.4; Δ% = (D − D₀) ÷ D₀ × 100; v = 60 × D ÷ D₀",
    "vars": [
      [
        "D",
        "New overall diameter (in)"
      ],
      [
        "R",
        "Rim diameter (in)"
      ],
      [
        "W",
        "Section width (mm)"
      ],
      [
        "a",
        "Aspect ratio (%)"
      ],
      [
        "D₀",
        "Old overall diameter (in)"
      ],
      [
        "v",
        "Actual speed at indicated 60"
      ]
    ],
    "note": "Swap is judged safe when |Δ%| ≤ 3; if D₀ = 0 then Δ% = 0 and v = 60."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const d1=rim+width*aspect/100*2/25.4,d2=oldRim+oldWidth*oldAspect/100*2/25.4;if(d1<=0||d2<=0) return {newDiameter:null,oldDiameter:null,diameterDiff:null,speedoError:null,recommendation:null,actualSpeed:null,__error:'inputError'};const diff=(d1-d2)/d2*100,actual=60*d1/d2;return {newDiameter:d1,oldDiameter:d2,diameterDiff:diff,speedoError:actual-60,recommendation:Math.abs(diff)<=3?'Within 3% rule of thumb — verify vehicle fitment':'Outside 3% rule of thumb — verify vehicle fitment',actualSpeed:actual};",
    "inputs": [
      {
        "name": "width",
        "type": "number",
        "default": 225,
        "min": 100,
        "max": 400,
        "step": 5,
        "slider": true
      },
      {
        "name": "aspect",
        "type": "number",
        "default": 45,
        "min": 20,
        "max": 90,
        "step": 5,
        "slider": true
      },
      {
        "name": "rim",
        "type": "number",
        "default": 17,
        "min": 10,
        "max": 26,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "oldWidth",
        "type": "number",
        "default": 205,
        "min": 100,
        "max": 400,
        "step": 5,
        "slider": true
      },
      {
        "name": "oldAspect",
        "type": "number",
        "default": 55,
        "min": 20,
        "max": 90,
        "step": 5,
        "slider": true
      },
      {
        "name": "oldRim",
        "type": "number",
        "default": 16,
        "min": 10,
        "max": 26,
        "step": 0.5,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "newDiameter",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "oldDiameter",
        "precision": 2,
        "unit": "in"
      },
      {
        "name": "diameterDiff",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "speedoError",
        "precision": 2,
        "unit": "mph"
      },
      {
        "name": "recommendation",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "actualSpeed",
        "precision": 1,
        "unit": "mph"
      }
    ],
    "interpret": null
  }
}
