{
  "schemaVersion": 1,
  "slug": "markup-calculator",
  "category": "finance",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "cabbc3f25d21c600a22fc8db478d9e0f51ed84fcef6200316c79cfca6763e71a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/markup-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": "P = C × (1 + u ÷ 100); M = (P − C) ÷ P × 100",
    "vars": [
      [
        "P",
        "selling price"
      ],
      [
        "C",
        "cost"
      ],
      [
        "u",
        "markup, %"
      ],
      [
        "M",
        "resulting margin, %"
      ]
    ],
    "note": "Price = cost × (1 + markup/100); margin = profit ÷ price. If cost and price are zero, margin is undefined."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const price=cost*(1+markupPercent/100),profit=price-cost;return{price,profit,margin:price>0?profit/price*100:null};",
    "inputs": [
      {
        "name": "cost",
        "type": "number",
        "default": 100,
        "min": 0,
        "max": 100000000,
        "step": 1
      },
      {
        "name": "markupPercent",
        "type": "number",
        "default": 50,
        "min": 0,
        "max": 10000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "price",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "profit",
        "precision": 2,
        "unit": ""
      },
      {
        "name": "margin",
        "precision": 2,
        "unit": "%",
        "optional": true
      }
    ],
    "interpret": null
  }
}
