{
  "schemaVersion": 1,
  "slug": "absolute-value-calculator",
  "category": "math",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "ded22f466cd47a23dee28f3f408b18554946297cd343d9572b21ec4685e63489",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/absolute-value-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": "|x| = { x, x ≥ 0; −x, x < 0 }",
    "vars": [
      [
        "|x|",
        "absolute value"
      ],
      [
        "x",
        "input number"
      ]
    ],
    "note": "Also returns sign(x), the opposite −x and the square x²."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "OpenStax — Absolute value",
        "url": "https://openstax.org/books/college-algebra-2e/pages/1-1-real-numbers-algebra-essentials"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "ded22f466cd47a23dee28f3f408b18554946297cd343d9572b21ec4685e63489",
    "basis": "|x| = { x, x ≥ 0; −x, x < 0 }",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "return { absolute: Math.abs(value), sign: Math.sign(value), opposite: -value, squared: value*value };",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": -42.5,
        "min": -1000000000000000,
        "max": 1000000000000000,
        "step": 0.0001
      }
    ],
    "outputs": [
      {
        "name": "absolute",
        "precision": 6,
        "unit": ""
      },
      {
        "name": "sign",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "opposite",
        "precision": 6,
        "unit": ""
      },
      {
        "name": "squared",
        "precision": 6,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
