{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nFix [[integers|0C4JS9RF5M]] $\\beta \\ge 2$ (the *base*), $p \\ge 1$ (the *precision*), and $e_{\\min} \u003c e_{\\max}$.\nA *floating-point number* of this system is $0$ or a real number of the form\n$$x = \\pm\\, (d_0 . d_1 d_2 \\ldots d_{p-1})_\\beta \\times \\beta^{e} = \\pm \\left( \\sum_{i=0}^{p-1} d_i \\beta^{-i} \\right) \\beta^{e}.$$\nHere the digits $d_i$ are integers with $0 \\le d_i \\le \\beta - 1$, and the exponent $e$ is an integer with $e_{\\min} \\le e \\le e_{\\max}$.\nThe number is *normalized* if $d_0 \\ne 0$.\nLet $F$ be the set of these numbers.\nLet $\\mathrm{fl}$ be a [[rounding|5NPVX29Y0C]] to $F$ of the real numbers between $\\min F$ and $\\max F$, usually rounding to nearest.\n*Floating-point arithmetic* replaces each operation $\\circ \\in \\set{+, -, \\times, /}$ on $x, y \\in F$, whenever $x \\circ y$ lies in this range, by\n$$x \\circledast y = \\mathrm{fl}(x \\circ y),$$\nthat is, the exact result rounded to $F$.\n\n## Remarks\n\nExample: with $\\beta = 10$ and $p = 3$, the numbers $x = 1.23$ and $y = 4.56 \\times 10^{-2}$ lie in $F$, and $x \\oplus y = \\mathrm{fl}(1.2756) = 1.28$ under rounding to nearest.\nNon-example: with $\\beta = 10$ and $p = 3$, the number $1.234$ is not in $F$, since it needs four significant digits.\nFloating-point addition is commutative but not associative: with $\\beta = 10$ and $p = 3$, $(1.00 \\oplus 0.004) \\oplus 0.004 = 1.00$, while $1.00 \\oplus (0.004 \\oplus 0.004) = 1.01$.\nIn the range of normalized numbers and with rounding to nearest, $x \\circledast y = (x \\circ y)(1 + \\delta)$ with $\\abs{\\delta} \\le \\tfrac12 \\beta^{1-p}$.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "RTKRSC3KPH",
    "kind": "definition",
    "msc": [
      "65G50",
      "65Y04"
    ],
    "name": "Floating-point arithmetic",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Floating-point_arithmetic"
      }
    ],
    "tag": "R8S821AD6T",
    "uses": [
      "5NPVX29Y0C",
      "0C4JS9RF5M"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/R8S821AD6T/",
  "links": [
    {
      "field": "defines",
      "target": "RTKRSC3KPH"
    },
    {
      "field": "uses",
      "target": "5NPVX29Y0C"
    },
    {
      "field": "uses",
      "target": "0C4JS9RF5M"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/R8S821AD6T.md",
  "msc": [
    "65G50",
    "65Y04"
  ],
  "name": "Floating-point arithmetic",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/R8S/R8S821AD6T.md",
  "status": null,
  "tag": "R8S821AD6T",
  "uri": "m2://R8S821AD6T",
  "url": "https://tamnd.github.io/math2/wiki/floating-point-arithmetic-definition/",
  "writing": {
    "tag": "R8S821AD6T",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
