{
  "id": "rounding",
  "version": "3eb85f9c12f6",
  "status": "published",
  "name": "Rounding Calculator",
  "question": "What is my number after rounding?",
  "summary": "Rounds a number to any place value from billions to billionths, rounding halves away from zero.",
  "category": "math",
  "subcategory": "arithmetic",
  "url": "https://www.acalculator.org/math/rounding-calculator",
  "markdown": "https://www.acalculator.org/math/rounding-calculator.md",
  "kind": "function",
  "method": "Round to the nearest multiple of the place value; a number exactly halfway rounds away from zero.",
  "assumptions": [
    "The number is taken as the decimal it is written as, so 1.005 is exactly halfway between 1.00 and 1.01.",
    "Halves round away from zero (round half up on the size of the number): 2.5 → 3 and −2.5 → −3.",
    "The answer is shown to at most 9 decimal places, enough for billionths."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "number": {
        "title": "Number to round",
        "description": "The number to round, as you would write it.",
        "type": "number"
      },
      "precision": {
        "title": "Round to",
        "description": "The place value to round to, from billions to billionths.",
        "type": "string",
        "enum": [
          "billions",
          "hundred_millions",
          "ten_millions",
          "millions",
          "hundred_thousands",
          "ten_thousands",
          "thousands",
          "hundreds",
          "tens",
          "ones",
          "tenths",
          "hundredths",
          "thousandths",
          "ten_thousandths",
          "hundred_thousandths",
          "millionths",
          "ten_millionths",
          "hundred_millionths",
          "billionths"
        ]
      }
    }
  },
  "outputs": {
    "rounded": {
      "label": "Rounded number",
      "description": "The number rounded to the chosen place value; halves round away from zero.",
      "format": "number"
    },
    "typed": {
      "label": "Number",
      "description": "The number to round, with every digit as typed, so the answer does not round it first.",
      "format": "text"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "number": 3.14159,
      "precision": "hundredths"
    },
    "outputs": {
      "rounded": 3.14,
      "typed": "3.14159"
    },
    "text": "3.14159 rounded to Hundredths (0.01) is 3.14."
  },
  "examples": [
    {
      "given": {
        "number": 3.14159,
        "precision": "hundredths"
      },
      "expect": {
        "rounded": 3.14
      },
      "source": "hand calculation in content.mdx: the thousandths digit is 1, below 5, so round down; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    },
    {
      "given": {
        "number": 1.005,
        "precision": "hundredths"
      },
      "expect": {
        "rounded": 1.01
      },
      "source": "hand calculation in content.mdx: 1.005 is exactly halfway, so it rounds up to 1.01; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    },
    {
      "given": {
        "number": -2.5,
        "precision": "ones"
      },
      "expect": {
        "rounded": -3
      },
      "source": "hand calculation in content.mdx: halfway, so away from zero; old page FAQ: -3.5 rounds to -4; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    },
    {
      "given": {
        "number": 1234567,
        "precision": "thousands"
      },
      "expect": {
        "rounded": 1235000
      },
      "source": "hand calculation in content.mdx: the hundreds digit is 5, so round up; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    },
    {
      "given": {
        "number": 3456.789,
        "precision": "tens"
      },
      "expect": {
        "rounded": 3460
      },
      "source": "old page FAQ and hand calculation in content.mdx: 3,456.789 to tens is 3,460; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    },
    {
      "given": {
        "number": 0.000123456,
        "precision": "millionths"
      },
      "expect": {
        "rounded": 0.000123
      },
      "source": "hand calculation in content.mdx: the ten-millionths digit is 4, so round down; OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions, rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
    }
  ],
  "sources": [
    "OpenStax, Prealgebra 2e, §5.1 Decimals (converting decimals to fractions; rounding decimals). https://openstax.org/books/prealgebra-2e/pages/5-1-decimals"
  ],
  "related": [],
  "changelog": [
    {
      "date": "2026-09-28",
      "note": "A number too small for 20 decimals is echoed in its plain form (1e-21)."
    },
    {
      "date": "2026-09-28",
      "note": "The answer repeats the number with every digit typed, not rounded to 6 decimals."
    },
    {
      "date": "2026-09-29",
      "note": "Worked examples name a published reference for their rule."
    }
  ]
}
