{
  "schemaVersion": 1,
  "slug": "recipe-scaler-calculator",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "6df1719af06d8be305145c1f44ef05300a24cbe408643bf7972d2febcf7e87d0",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/recipe-scaler-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": "f = S₂÷S₁; x₂ = x₁×f; Δ = (f−1)×100",
    "vars": [
      [
        "S₁",
        "Original servings"
      ],
      [
        "S₂",
        "Desired servings"
      ],
      [
        "x₁",
        "Original amount"
      ],
      [
        "x₂",
        "New amount"
      ],
      [
        "f",
        "Scaling factor"
      ],
      [
        "Δ",
        "Change (%)"
      ]
    ],
    "note": "Ingredient amounts scale linearly by the serving factor. Seasoning, cooking time, pan size and texture may not scale linearly."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const factor = originalServings>0 ? desiredServings/originalServings : 0; return { factor, newAmount: ingredientAmount*factor, difference: (factor-1)*100 };",
    "inputs": [
      {
        "name": "originalServings",
        "type": "number",
        "default": 4,
        "min": 0.1,
        "max": 10000,
        "step": 1
      },
      {
        "name": "desiredServings",
        "type": "number",
        "default": 6,
        "min": 0.1,
        "max": 10000,
        "step": 1
      },
      {
        "name": "ingredientAmount",
        "type": "number",
        "default": 200,
        "min": 0,
        "max": 1000000,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "name": "newAmount",
        "precision": 4,
        "unit": ""
      },
      {
        "name": "factor",
        "precision": 4,
        "unit": "x"
      },
      {
        "name": "difference",
        "precision": 1,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
