{
  "schemaVersion": 1,
  "slug": "ring-size-converter",
  "category": "fashion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "fa2c0228a0dfb1361a052ef140d3e561da9896c3345cf358884171349a4f8045",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/ring-size-converter.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_US = 44.2 + (US − 3)×2.55; C_EU = EU; C_JP = (JP÷3 + 12.67)×π; d = C÷π",
    "vars": [
      [
        "C",
        "Estimated inside circumference (mm)"
      ],
      [
        "d",
        "Estimated inside diameter (mm)"
      ],
      [
        "US/EU/JP",
        "Selected sizing reference"
      ]
    ],
    "note": "Selected source scale is converted to an estimated circumference. The model rounds US to half sizes, derives UK/EU/Japan labels and is approximate; retail charts may differ."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const us = system === 'us' ? size : system === 'eu' ? 3 + (size - 44.2)/2.55 : 3 + (((size/3 + 12.67)*Math.PI) - 44.2)/2.55; const u = Math.round(us*2)/2; const circ = 44.2 + (u - 3)*2.55; const dia = circ/Math.PI; const li = Math.max(1, Math.round(u*2)); return { us: String(u), uk: String.fromCharCode(64 + Math.min(26, li)), eu: String(Math.round(circ)), jp: String(Math.round(3*(dia - 12.67))), diameter: dia, circumference: circ };",
    "inputs": [
      {
        "name": "system",
        "type": "select",
        "default": "us",
        "options": [
          {
            "value": "us"
          },
          {
            "value": "eu"
          },
          {
            "value": "jp"
          }
        ]
      },
      {
        "name": "size",
        "type": "number",
        "default": 7,
        "min": 3,
        "max": 13,
        "step": 0.5,
        "unitField": "system",
        "minByUnit": {
          "us": 3,
          "eu": 44,
          "jp": 4
        },
        "maxByUnit": {
          "us": 13,
          "eu": 70,
          "jp": 29
        },
        "stepByUnit": {
          "us": 0.5,
          "eu": 1,
          "jp": 1
        },
        "unitTransforms": {
          "us": {
            "scale": 2.55,
            "offset": 36.55
          },
          "eu": {
            "scale": 1,
            "offset": 0
          },
          "jp": {
            "scale": 1.0471975511965976,
            "offset": 39.80397892098268
          }
        }
      }
    ],
    "outputs": [
      {
        "name": "us",
        "precision": 1,
        "unit": "",
        "type": "text"
      },
      {
        "name": "uk",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "eu",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "jp",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "diameter",
        "precision": 1,
        "unit": "mm"
      },
      {
        "name": "circumference",
        "precision": 1,
        "unit": "mm"
      }
    ],
    "interpret": null
  }
}
