{
  "schemaVersion": 1,
  "slug": "cake-serving-calculator",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "fe930c908b61bb838e2dcb3774c445519b4f815d1d2dd16a0cfa7fe642538e26",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/cake-serving-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": "N = ⌊π(d ÷ 2)²·L ÷ a⌋",
    "vars": [
      [
        "N",
        "Number of servings"
      ],
      [
        "d",
        "Cake diameter, in"
      ],
      [
        "L",
        "Number of layers"
      ],
      [
        "a",
        "Slice area: 2/4/6 in²"
      ]
    ],
    "note": "Slice areas are 2, 4 and 6 in²; servings = floor(total round-layer area ÷ slice area). Batter estimate assumes the pan is filled to 60% of its volume."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "King Arthur Baking — Recipe and pan-size conversions",
        "url": "https://www.kingarthurbaking.com/blog/2019/04/23/the-essential-alternative-baking-pan-sizes"
      }
    ],
    "referenceRole": "context",
    "implementationHash": "fe930c908b61bb838e2dcb3774c445519b4f815d1d2dd16a0cfa7fe642538e26",
    "basis": "N = ⌊π(d ÷ 2)²·L ÷ a⌋",
    "limitations": "The references provide context and limitations. They do not validate this page’s illustrative multipliers, lookup values or predictions."
  },
  "contract": {
    "compute": "const perSlice = sliceSize === 'wedding' ? 2 : sliceSize === 'dessert' ? 6 : 4; const area = Math.PI*Math.pow(diameter/2,2); const perLayerCups = area*depth*0.6/14.4375; return { servings: Math.floor(area*layers/perSlice), areaPerLayer: area, batterCups: perLayerCups*layers, cupsPerLayer: perLayerCups };",
    "inputs": [
      {
        "name": "diameter",
        "type": "number",
        "default": 8,
        "min": 1,
        "max": 30,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "depth",
        "type": "number",
        "default": 2,
        "min": 0.5,
        "max": 6,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "layers",
        "type": "number",
        "default": 2,
        "min": 1,
        "max": 6,
        "step": 1
      },
      {
        "name": "sliceSize",
        "type": "select",
        "default": "party",
        "options": [
          {
            "value": "wedding"
          },
          {
            "value": "party"
          },
          {
            "value": "dessert"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "servings",
        "precision": 0,
        "unit": "servings"
      },
      {
        "name": "areaPerLayer",
        "precision": 1,
        "unit": "in²"
      },
      {
        "name": "batterCups",
        "precision": 1,
        "unit": "cups"
      },
      {
        "name": "cupsPerLayer",
        "precision": 2,
        "unit": "cups"
      }
    ],
    "interpret": null
  }
}
