{
  "schemaVersion": 1,
  "slug": "suit-size-calculator",
  "category": "fashion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "a00296d72518b69640b9b0d26295b788723f54a351bb02aef64302e9710a9334",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/suit-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": "jacket = round(chest_in); trouser_waist = round(waist_in); drop = chest_in − waist_in; length = S/R/L at 66 and 72 in",
    "vars": [
      [
        "chest_in",
        "Chest circumference (in)"
      ],
      [
        "waist_in",
        "Waist circumference (in)"
      ],
      [
        "height_in",
        "Height (in)"
      ],
      [
        "drop",
        "Chest minus waist (in)"
      ],
      [
        "length",
        "Length code S/R/L"
      ]
    ],
    "note": "Simplified men’s ready-to-wear reference. The measurement difference is not used to assign a body type or fit category."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const k=unit==='cm'?1/2.54:1,c=chest*k,w=waist*k,h=height*k;return {jacketSize:Math.round(c),trouserWaist:Math.round(w),drop:c-w,lengthCode:h<66?'S':h<72?'R':'L'};",
    "inputs": [
      {
        "name": "chest",
        "type": "number",
        "default": 40,
        "min": 28,
        "max": 70,
        "step": 0.5,
        "unitField": "unit",
        "minByUnit": {
          "in": 28,
          "cm": 71.12
        },
        "maxByUnit": {
          "in": 70,
          "cm": 177.8
        },
        "unitScales": {
          "in": 1,
          "cm": 0.39370078740157477
        }
      },
      {
        "name": "waist",
        "type": "number",
        "default": 34,
        "min": 22,
        "max": 70,
        "step": 0.5,
        "unitField": "unit",
        "minByUnit": {
          "in": 22,
          "cm": 55.88
        },
        "maxByUnit": {
          "in": 70,
          "cm": 177.8
        },
        "unitScales": {
          "in": 1,
          "cm": 0.39370078740157477
        }
      },
      {
        "name": "height",
        "type": "number",
        "default": 70,
        "min": 55,
        "max": 84,
        "step": 0.5,
        "unitField": "unit",
        "minByUnit": {
          "in": 55,
          "cm": 139.7
        },
        "maxByUnit": {
          "in": 84,
          "cm": 213.36
        },
        "unitScales": {
          "in": 1,
          "cm": 0.39370078740157477
        }
      },
      {
        "name": "unit",
        "type": "select",
        "default": "in",
        "options": [
          {
            "value": "in"
          },
          {
            "value": "cm"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "jacketSize",
        "precision": 0,
        "unit": "in"
      },
      {
        "name": "trouserWaist",
        "precision": 0,
        "unit": "in"
      },
      {
        "name": "drop",
        "precision": 1,
        "unit": "in"
      },
      {
        "name": "lengthCode",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
