{
  "schemaVersion": 1,
  "slug": "abv-calculator",
  "category": "cooking",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "6f9851c1c8c45a6a5b12751bc8f13ea7481c5915e0a740b442370161f0f0d19d",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/abv-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": "ABV = (OG − FG) × 131.25",
    "vars": [
      [
        "ABV",
        "alcohol by volume (%)"
      ],
      [
        "OG",
        "original gravity"
      ],
      [
        "FG",
        "final gravity"
      ]
    ],
    "note": "Specific gravity readings are dimensionless (for example, 1.050 and 1.010). ABV is a homebrewing approximation; ABW uses a fixed conversion approximation. The displayed drink count assumes a 330 mL serving and the U.S. 14 g definition."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const abv=(og-fg)*131.25; const att=og>1?(og-fg)/(og-1)*100:0; const alcoholGramsPer330=330*(Math.max(abv,0)/100)*0.789; return {abv:Math.max(abv,0),abw:Math.max(abv,0)*0.795,attenuation:att,standardDrinks:alcoholGramsPer330/14};",
    "inputs": [
      {
        "name": "og",
        "type": "number",
        "default": 1.05,
        "min": 0.99,
        "max": 1.2,
        "step": 0.001,
        "slider": true
      },
      {
        "name": "fg",
        "type": "number",
        "default": 1.01,
        "min": 0.98,
        "max": 1.2,
        "step": 0.001,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "abv",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "abw",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "attenuation",
        "precision": 1,
        "unit": "%"
      },
      {
        "name": "standardDrinks",
        "precision": 2,
        "unit": "drinks"
      }
    ],
    "interpret": null
  }
}
