{
  "schemaVersion": 1,
  "slug": "butter-converter",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "56076dc10629af14cb43a40ef2d86d392ccba1b293e2722bf00cf436aa7baa26",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/butter-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": "m_g = v·k;  m_out = m_g ÷ k_target",
    "vars": [
      [
        "m_g",
        "Butter mass in grams"
      ],
      [
        "v",
        "Entered value"
      ],
      [
        "k",
        "Grams per selected input unit"
      ],
      [
        "k_target",
        "Grams per output unit"
      ],
      [
        "m_out",
        "Converted butter mass in output units"
      ]
    ],
    "note": "k: stick 113.4 g, cup 226.8 g, tbsp 14.17 g, tsp 4.72 g, oz 28.35 g."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const G = { stick:113.3980925, cup:226.796185, tbsp:14.1747615625, tsp:4.7249205208, g:1, oz:28.349523125 }; const grams = value*(G[unit]||1); return { sticks: grams/G.stick, cups: grams/G.cup, grams, tablespoons: grams/G.tbsp, ounces: grams/28.349523125 };",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 10000,
        "step": 0.25
      },
      {
        "name": "unit",
        "type": "select",
        "default": "stick",
        "options": [
          {
            "value": "stick"
          },
          {
            "value": "cup"
          },
          {
            "value": "tbsp"
          },
          {
            "value": "tsp"
          },
          {
            "value": "g"
          },
          {
            "value": "oz"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "sticks",
        "precision": 3,
        "unit": "sticks"
      },
      {
        "name": "cups",
        "precision": 4,
        "unit": "cups"
      },
      {
        "name": "grams",
        "precision": 1,
        "unit": "g"
      },
      {
        "name": "tablespoons",
        "precision": 1,
        "unit": "tbsp"
      },
      {
        "name": "ounces",
        "precision": 2,
        "unit": "oz"
      }
    ],
    "interpret": null
  }
}
