{
  "schemaVersion": 1,
  "slug": "voltage-calculator",
  "category": "conversion",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "21722e75668f871500985adb649981761109137cf7eaa67247ed697f7b2619c1",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/voltage-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": "V = x×F[from]÷F[to]",
    "vars": [
      [
        "x",
        "Value"
      ],
      [
        "from",
        "Source unit"
      ],
      [
        "to",
        "Target unit"
      ],
      [
        "F",
        "Factor to volts"
      ],
      [
        "V",
        "Result"
      ]
    ],
    "note": "F: V 1, mV 0.001, µV 10⁻⁶, kV 1000, MV 10⁶; output also shows the value in V and mV."
  },
  "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": "Convert electric potential via volts and SI prefixes.",
    "limitations": "Only the displayed unit definitions are converted; rounding and measurement uncertainty are separate.",
    "implementationHash": "21722e75668f871500985adb649981761109137cf7eaa67247ed697f7b2619c1",
    "domain": "conversion"
  },
  "contract": {
    "compute": "const units={\"v\":\"V\",\"mv\":\"mV\",\"uv\":\"µV\",\"kv\":\"kV\",\"megav\":\"MV\"}, factors={\"v\":1,\"mv\":0.001,\"uv\":0.000001,\"kv\":1000,\"megav\":1000000}; if(!Number.isFinite(value)||value<-1000000000000||value>1000000000000||!Object.prototype.hasOwnProperty.call(units,from)||!Object.prototype.hasOwnProperty.call(units,to))return {\"result\":null,\"volts\":null,\"millivolts\":null,\"__error\":\"inputError\"}; const out=(function(){const F={v:1,mv:0.001,uv:1e-6,kv:1000,megav:1e6}; const v=value*F[from]; return { result: v/F[to], volts: v, millivolts: v*1000 };})(); if(out.__error)return {...{\"result\":null,\"volts\":null,\"millivolts\":null},...out}; out.__resultUnit=units[to]; out.__unitRatio=factors[to]/factors[from]; return out;",
    "inputs": [
      {
        "name": "value",
        "type": "number",
        "default": 1,
        "min": -1000000000000,
        "max": 1000000000000,
        "step": 0.0001,
        "requiredValue": true,
        "strictRange": true
      },
      {
        "name": "from",
        "type": "select",
        "default": "mv",
        "options": [
          {
            "value": "mv"
          },
          {
            "value": "v"
          },
          {
            "value": "uv"
          },
          {
            "value": "kv"
          },
          {
            "value": "megav"
          }
        ]
      },
      {
        "name": "to",
        "type": "select",
        "default": "v",
        "options": [
          {
            "value": "v"
          },
          {
            "value": "mv"
          },
          {
            "value": "uv"
          },
          {
            "value": "kv"
          },
          {
            "value": "megav"
          }
        ]
      },
      {
        "name": "precision",
        "type": "select",
        "default": 4,
        "options": [
          {
            "value": 0
          },
          {
            "value": 2
          },
          {
            "value": 4
          },
          {
            "value": 6
          }
        ]
      }
    ],
    "outputs": [
      {
        "name": "result",
        "precision": 4,
        "unit": "",
        "precisionField": "precision",
        "unitField": "__resultUnit",
        "trimTrailingZeros": true,
        "notation": "auto"
      },
      {
        "name": "volts",
        "precision": 6,
        "unit": "V",
        "showWhen": {
          "to": [
            "mv",
            "uv",
            "kv",
            "megav"
          ]
        },
        "notation": "auto"
      },
      {
        "name": "millivolts",
        "precision": 4,
        "unit": "mV",
        "showWhen": {
          "to": [
            "v",
            "uv",
            "kv",
            "megav"
          ]
        },
        "notation": "auto"
      }
    ],
    "interpret": null
  }
}
