{
  "schemaVersion": 1,
  "slug": "jeans-size-calculator",
  "category": "fashion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "625da8ae0d2c393014d253adabce25b5cefae69dc90ee364c62d0813ead6704d",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/jeans-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": "W = round(w); L = round(l ÷ 2) × 2",
    "vars": [
      [
        "W",
        "Waist size"
      ],
      [
        "L",
        "Leg length size"
      ],
      [
        "w",
        "Measured waist (in)"
      ],
      [
        "l",
        "Measured inseam (in)"
      ]
    ],
    "note": "No fit adjustment is applied. Convert measurements to inches; W is the rounded waist and L is the nearest even-inch inseam. This is a US W × L reference, not a brand-specific fit prediction."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "Levi’s — Body measurement and size charts",
        "url": "https://www.levi.com/US/en_US/info/sizeguide"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "625da8ae0d2c393014d253adabce25b5cefae69dc90ee364c62d0813ead6704d",
    "basis": "W = round(w); L = round(l ÷ 2) × 2",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const k=unit==='cm'?1/2.54:1,w=waist*k,l=inseam*k,valid=(v,minIn,maxIn)=>Number.isFinite(v)&&v>=(unit==='cm'?minIn*2.54:minIn)&&v<=(unit==='cm'?maxIn*2.54:maxIn); if(!valid(waist,20,70)||!valid(inseam,22,40))return {waistSize:null,lengthSize:null,jeansSize:null,waistCm:null,inseamCm:null,__error:'inputError'}; const ws=Math.round(w),ls=Math.round(l/2)*2; return {waistSize:ws,lengthSize:ls,jeansSize:'W'+ws+' L'+ls,waistCm:ws*2.54,inseamCm:l*2.54};",
    "inputs": [
      {
        "name": "waist",
        "type": "number",
        "default": 32,
        "min": 20,
        "max": 70,
        "step": 0.5,
        "unitField": "unit",
        "minByUnit": {
          "in": 20,
          "cm": 50.8
        },
        "maxByUnit": {
          "in": 70,
          "cm": 177.8
        },
        "unitScales": {
          "in": 1,
          "cm": 0.39370078740157477
        }
      },
      {
        "name": "inseam",
        "type": "number",
        "default": 32,
        "min": 22,
        "max": 40,
        "step": 0.5,
        "unitField": "unit",
        "minByUnit": {
          "in": 22,
          "cm": 55.88
        },
        "maxByUnit": {
          "in": 40,
          "cm": 101.6
        },
        "unitScales": {
          "in": 1,
          "cm": 0.39370078740157477
        }
      },
      {
        "name": "unit",
        "type": "select",
        "default": "in",
        "options": [
          {
            "value": "in"
          },
          {
            "value": "cm"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "waistSize",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "lengthSize",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "jeansSize",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "waistCm",
        "precision": 1,
        "unit": "cm"
      },
      {
        "name": "inseamCm",
        "precision": 1,
        "unit": "cm"
      }
    ],
    "interpret": null
  }
}
