{
  "schemaVersion": 1,
  "slug": "cooking-cups-ml-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "44a0f3c773ae93560a710a30d0ba62942c2c85776e286ad14f7bc74eb34324ba",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/cooking-cups-ml-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": "ml = cups × 236.5882365; cups = ml ÷ 236.5882365",
    "vars": [
      [
        "cups",
        "number of cups"
      ],
      [
        "ml",
        "millilitres"
      ]
    ],
    "note": "US cup = 236.588 ml; metric cup = 250 ml; 1 fl oz = 29.5735 ml."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-04",
    "sources": [
      {
        "name": "NIST SP 811 — Conversion factors by quantity",
        "url": "https://www.nist.gov/pml/special-publication-811/nist-guide-si-appendix-b-conversion-factors/nist-guide-si-appendix-b9"
      }
    ],
    "basis": "The US customary cup is 236.5882365 mL; the separate metric-cup option is defined as 250 mL.",
    "limitations": "US customary and imperial liquid measures differ. This is volume, not ingredient mass; no density conversion is performed.",
    "implementationHash": "44a0f3c773ae93560a710a30d0ba62942c2c85776e286ad14f7bc74eb34324ba",
    "domain": "conversion"
  },
  "contract": {
    "compute": "const F={\"cup\":236.5882365,\"mcup\":250,\"ml\":1}, U={\"cup\":\"US cup\",\"mcup\":\"250 mL cup\",\"ml\":\"mL\"}, L={\"cup2ml\":[\"cup\",\"ml\"],\"ml2cup\":[\"ml\",\"cup\"],\"mcup2ml\":[\"mcup\",\"ml\"]}; const pair=Object.prototype.hasOwnProperty.call(L,direction)?L[direction]:[from,to], source=pair[0], target=pair[1]; if(!Number.isFinite(value)||value<0||value>1000000||!Object.prototype.hasOwnProperty.call(F,source)||!Object.prototype.hasOwnProperty.call(F,target))return {\"result\":null,\"ml\":null,\"cups\":null,\"flOz\":null,\"litres\":null,\"__error\":\"inputError\"}; const base=value*F[source], out=(function(value,direction){const ml = direction === 'ml2cup' ? value : value*(direction === 'mcup2ml' ? 250 : 236.5882365); const cups = ml/236.5882365; return { result: direction === 'ml2cup' ? cups : ml, ml, cups, flOz: ml/29.5735295625, litres: ml/1000 };})(base/F[\"cup\"],\"cup2ml\"); if(out.__error)return {...{\"result\":null,\"ml\":null,\"cups\":null,\"flOz\":null,\"litres\":null},...out}; out.result=value*(F[source]/F[target]);out.__resultUnit=U[target];out.__unitRatio=F[target]/F[source];return out;",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 1000000,
        "step": 0.01,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "direction",
        "type": "select",
        "default": "auto",
        "options": [
          {
            "value": "auto"
          },
          {
            "value": "cup2ml"
          },
          {
            "value": "ml2cup"
          },
          {
            "value": "mcup2ml"
          }
        ],
        "showWhen": {
          "from": []
        }
      },
      {
        "name": "precision",
        "type": "select",
        "default": 4,
        "options": [
          {
            "value": 0
          },
          {
            "value": 2
          },
          {
            "value": 4
          },
          {
            "value": 6
          }
        ]
      },
      {
        "name": "from",
        "type": "select",
        "default": "cup",
        "options": [
          {
            "value": "cup"
          },
          {
            "value": "mcup"
          },
          {
            "value": "ml"
          }
        ]
      },
      {
        "name": "to",
        "type": "select",
        "default": "ml",
        "options": [
          {
            "value": "ml"
          },
          {
            "value": "cup"
          },
          {
            "value": "mcup"
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "unit": "",
        "precisionField": "precision",
        "unitField": "__resultUnit",
        "trimTrailingZeros": true,
        "notation": "auto"
      },
      {
        "name": "ml",
        "precision": 2,
        "unit": "ml",
        "notation": "auto",
        "showWhen": {
          "to": [
            "cup",
            "mcup"
          ]
        }
      },
      {
        "name": "cups",
        "precision": 4,
        "unit": "cups",
        "notation": "auto",
        "showWhen": {
          "to": [
            "mcup",
            "ml"
          ]
        }
      },
      {
        "name": "flOz",
        "precision": 3,
        "unit": "fl oz",
        "notation": "auto"
      },
      {
        "name": "litres",
        "precision": 4,
        "unit": "L",
        "notation": "auto"
      }
    ],
    "interpret": null
  }
}
