{
  "schemaVersion": 1,
  "slug": "ring-size-calculator",
  "category": "fashion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "1f0f3b1e1648eb0d527f49425b0d546ace7b2121999574a2837a7e68c0a48381",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/ring-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": "C = input if circumference, else π × diameter; US = round(2(3 + (C − 44.2)÷2.55 + a))÷2",
    "vars": [
      [
        "C",
        "Inside circumference (mm)"
      ],
      [
        "d",
        "Inside diameter (mm)"
      ],
      [
        "a",
        "Fit shift: −0.25/0/+0.25"
      ],
      [
        "US",
        "Estimated US half size"
      ]
    ],
    "note": "C is inside circumference in mm; a = −0.25 snug, 0 regular, +0.25 loose. The 2.55 mm step is a simplified US reference; confirm physical fit."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const circ = method === 'circumference' ? value : value*Math.PI; const raw = 3 + (circ - 44.2)/2.55; const adjust = fit === 'snug' ? -0.25 : fit === 'loose' ? 0.25 : 0; const us = Math.round((raw + adjust)*2)/2; return { usSize: us, diameter: circ/Math.PI, circumference: circ, adjustment: us <= 3 ? 'Very small — check your measurement' : us >= 13 ? 'Very large — consider a custom band' : 'Standard range' };",
    "inputs": [
      {
        "name": "method",
        "type": "select",
        "default": "circumference",
        "options": [
          {
            "value": "circumference"
          },
          {
            "value": "diameter"
          }
        ]
      },
      {
        "name": "value",
        "type": "number",
        "default": 54,
        "min": 30,
        "max": 80,
        "step": 0.01,
        "unitField": "method",
        "minByUnit": {
          "circumference": 30,
          "diameter": 9.549
        },
        "maxByUnit": {
          "circumference": 80,
          "diameter": 25.465
        },
        "unitScales": {
          "circumference": 1,
          "diameter": 3.141592653589793
        }
      },
      {
        "name": "fit",
        "type": "select",
        "default": "regular",
        "options": [
          {
            "value": "snug"
          },
          {
            "value": "regular"
          },
          {
            "value": "loose"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "usSize",
        "precision": 1,
        "unit": ""
      },
      {
        "name": "diameter",
        "precision": 1,
        "unit": "mm"
      },
      {
        "name": "circumference",
        "precision": 1,
        "unit": "mm"
      },
      {
        "name": "adjustment",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
