{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $F$ be a set of [[floating-point numbers|RTKRSC3KPH]] and let $\\mathrm{fl} \\colon \\R \\to F$ be a [[rounding|5NPVX29Y0C]].\nThe *round-off error* of representing $x \\in \\R$ is $\\mathrm{fl}(x) - x$, and for $x \\ne 0$ its *relative round-off error* is $(\\mathrm{fl}(x) - x)/x$.\nLet an algorithm compute $y = f(x)$ in exact real arithmetic, and let it return $\\hat y$ when each operation is done in floating-point arithmetic.\nThen the round-off error of the computation is $\\hat y - y$.\n\n## Remarks\n\nExample: with base $10$, precision $3$ and rounding to nearest, $\\mathrm{fl}(2/3) = 0.667$, so the round-off error is $0.667 - 2/3 = 1/3000$ and the relative round-off error is $1/2000 = 0.0005$.\nThis is within the unit roundoff $u = \\tfrac12 \\cdot 10^{-2}$ of the system.\nNon-example: replacing $e = \\sum_{k \\ge 0} 1/k!$ by $\\sum_{k=0}^{5} 1/k!$ in exact arithmetic gives an error, but it is a truncation error, not a round-off error.\nIf $x$ lies in the range of normalized numbers and $\\mathrm{fl}$ rounds to nearest, then $\\abs{\\mathrm{fl}(x) - x} \\le u \\abs{x}$, where $u = \\tfrac12 \\beta^{1-p}$ is the unit roundoff, see [[machine epsilon|JA3QXVF2B8]].\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "CPN6SD3BTV",
    "kind": "definition",
    "msc": [
      "65G50"
    ],
    "name": "Round-off error",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Round-off_error"
      }
    ],
    "tag": "PA1B7DJ0C4",
    "uses": [
      "5NPVX29Y0C",
      "RTKRSC3KPH",
      "JA3QXVF2B8"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/PA1B7DJ0C4/",
  "links": [
    {
      "field": "defines",
      "target": "CPN6SD3BTV"
    },
    {
      "field": "uses",
      "target": "5NPVX29Y0C"
    },
    {
      "field": "uses",
      "target": "RTKRSC3KPH"
    },
    {
      "field": "uses",
      "target": "JA3QXVF2B8"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/PA1B7DJ0C4.md",
  "msc": [
    "65G50"
  ],
  "name": "Round-off error",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/PA1/PA1B7DJ0C4.md",
  "status": null,
  "tag": "PA1B7DJ0C4",
  "uri": "m2://PA1B7DJ0C4",
  "url": "https://tamnd.github.io/math2/wiki/round-off-error-definition/",
  "writing": {
    "tag": "PA1B7DJ0C4",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
