{
  "schemaVersion": 1,
  "slug": "circumference-calculator",
  "category": "geometry",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "c7036559832e48f9e2a0f513c93b32bbb9bedc3e6d87f6143e863ee019b4b9e8",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/circumference-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 = 2πr = πd; A = πr²; r = d/2 = C/(2π) = √(A/π)",
    "vars": [
      [
        "C",
        "Circumference"
      ],
      [
        "r",
        "Radius"
      ],
      [
        "d",
        "Diameter"
      ],
      [
        "A",
        "Area"
      ]
    ],
    "note": "Choose the measurement you know: radius, diameter, circumference or area. Lengths use centimetres and area uses square centimetres. For example, a circumference of 20 cm gives diameter 20/π ≈ 6.3662 cm. Use C = πd = 2πr and A = πr²."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-10",
    "sources": [
      {
        "name": "OpenStax — Geometric formulas",
        "url": "https://openstax.org/books/prealgebra/pages/c-geometric-formulas"
      }
    ],
    "basis": "C = 2πr = πd; radius is r, d/2, C/(2π) or sqrt(A/π), according to the selected known measurement.",
    "limitations": "Ideal Euclidean shapes; use consistent length units. A diameter is twice the radius.",
    "implementationHash": "c7036559832e48f9e2a0f513c93b32bbb9bedc3e6d87f6143e863ee019b4b9e8",
    "domain": "math"
  },
  "contract": {
    "compute": "const empty={circumference:null,diameter:null,area:null,radius:null};const v=Number(value);if(!Number.isFinite(v)||v<0||v>1000000000||!['radius','area','diameter','circumference'].includes(mode))return{...empty,__error:'inputError'};const r=mode==='area'?Math.sqrt(v/Math.PI):mode==='diameter'?v/2:mode==='circumference'?v/(2*Math.PI):v;return{circumference:2*Math.PI*r,diameter:2*r,area:Math.PI*r*r,radius:r};",
    "inputs": [
      {
        "name": "mode",
        "type": "select",
        "default": "radius",
        "options": [
          {
            "value": "radius"
          },
          {
            "value": "area"
          },
          {
            "value": "diameter"
          },
          {
            "value": "circumference"
          }
        ]
      },
      {
        "name": "value",
        "type": "number",
        "default": 10,
        "step": 0.001,
        "min": 0,
        "max": 1000000000,
        "requiredValue": true,
        "strictRange": true
      }
    ],
    "outputs": [
      {
        "name": "circumference",
        "precision": 4,
        "unit": "cm"
      },
      {
        "name": "diameter",
        "precision": 4,
        "unit": "cm"
      },
      {
        "name": "area",
        "precision": 4,
        "unit": "cm²"
      },
      {
        "name": "radius",
        "precision": 4,
        "unit": "cm"
      }
    ],
    "interpret": null
  }
}
