Home › Math › Rounding Calculator
Rounding Calculator
Rounds a number to a given number of decimal places (negative for tens, hundreds, …) or significant figures using round-half-away-from-zero, and also reports the ceiling, floor and truncated values at the same precision.
When to use
You need a number rounded to a fixed number of decimals or significant figures, or its ceiling/floor at that precision, with the exact decimal behaviour (2.675 → 2.68).
Do not use when: You want a number written in scientific or engineering notation (use scientific-notation).
Formula
rounded = round_half_away(value × 10^p) / 10^p, where p = precision (decimals) or p = precision − 1 − ⌊log10|value|⌋ (significant figures); ceiling, floor and truncated use ⌈·⌉, ⌊·⌋ and trunc(·) instead
The decimal shift uses the exact decimal digits of the input, so ties such as 2.675 are recognised as ties and rounded away from zero (2.68) instead of following binary floating-point noise (2.67).
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
value | number | yes | The number to round. Range: ≥ -1000000000000, ≤ 1000000000000 | |
precision | integer | default 2 | Decimal places when mode is decimals (negative rounds to tens, hundreds, …), or the number of significant figures (1–12) when mode is significant_figures. Range: ≥ -9, ≤ 12 | |
mode | enum: decimals | significant_figures | default decimals | Whether precision counts decimal places or significant figures. |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
rounded | number | Value rounded half away from zero at the requested precision. | |
rounded_text | string | The rounded value written with the requested number of decimals, e.g. '2.68' or '12300'. | |
ceiling | number | Smallest value at that precision that is ≥ value. | |
floor | number | Largest value at that precision that is ≤ value. | |
truncated | number | Value with the extra digits dropped (rounded toward zero). | |
decimal_places_used | integer | The decimal-place count actually used (derived from the magnitude in significant-figure mode). |
Example
2.675 to 2 decimals: {"value":2.675,"precision":2,"mode":"decimals"} → {"rounded":2.68,"rounded_text":"2.68","ceiling":2.68,"floor":2.67,"truncated":2.67,"decimal_places_used":2}
12345.678 to 3 significant figures: {"value":12345.678,"precision":3,"mode":"significant_figures"} → {"rounded":12300,"rounded_text":"12300","ceiling":12400,"floor":12300,"truncated":12300,"decimal_places_used":-2}
GET https://tttkmbb.com/api/v1/calculate/rounding?value=2.675&precision=2&mode=decimals
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/rounding(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/rounding · Markdown: https://tttkmbb.com/math/rounding.md · JSON definition: https://tttkmbb.com/math/rounding.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="rounding" - OpenAPI operationId:
calculate_rounded_value - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Rounding (reference)
- Wikipedia – Significant figures (reference)
- Wolfram MathWorld – Significant Digits (reference)
FAQ
Which tie-breaking rule is used?
Round half away from zero: 2.5 → 3, −2.5 → −3, 2.675 → 2.68. Spreadsheets use the same rule; Python's round() and IEEE 754 default to round-half-to-even, which gives 2 for 2.5.
How do I round to the nearest hundred?
Use mode decimals with precision −2: 12345.678 → 12300.
Related calculators
- Scientific Notation Converter — Write the rounded number in scientific or engineering form.
- Percentage Calculator — Percent results that usually need rounding.