Rounding Calculator
Inputs
| Number | 3.14159 |
|---|---|
| Decimal places | 2 |
| Rounding mode | Round half up |
Rounding Calculator
Round any number to a chosen number of decimal places. Choose from five standard modes — half-up, banker's, floor, ceiling, or truncate — and compare results side by side.
Inputs
Results
Enter a value to see results.
Other Rounding Methods
Rounding is the process of replacing a number with an approximation that has fewer significant digits, while keeping the value as close to the original as possible. The result depends on two choices: how many decimal places to keep and which tie-breaking rule to apply when the dropped portion is exactly half.
The five rounding modes
Round half up
The most familiar rule in everyday use. When the portion being dropped is exactly 0.5, the result rounds toward positive infinity.
- 2.5 → 3
- −2.5 → −2 (toward +∞, not away from zero)
This is the rule taught in most schools and implemented in many spreadsheet functions.
Round half to even (banker's rounding)
When the dropped portion is exactly 0.5, the result rounds to whichever neighbor ends in an even digit.
- 2.5 → 2 (2 is even)
- 3.5 → 4 (4 is even)
- 4.5 → 4 (4 is even)
- 5.5 → 6 (6 is even)
Banker's rounding is the default in IEEE 754 floating-point arithmetic and in the round() function of Python 3, Java's RoundingMode.HALF_EVEN, and C#'s MidpointRounding.ToEven. Its advantage over round-half-up is that it eliminates the systematic upward bias that accumulates when large datasets contain many exact midpoints.
Floor
Floor always rounds toward negative infinity, regardless of the fractional part.
- 2.9 → 2
- −2.1 → −3
Ceiling
Ceiling always rounds toward positive infinity, regardless of the fractional part.
- 2.1 → 3
- −2.9 → −2
Truncate
Truncate drops the fractional part and rounds toward zero. For positive numbers, truncate and floor are identical. They differ for negatives.
- 2.9 → 2 (same as floor)
- −2.9 → −2 (not −3, unlike floor)
The formula
Given a number x and d decimal places:
- Compute the scale: s = 10^d
- Multiply: x × s
- Apply the chosen rounding rule to get an integer n
- Divide: n / s
For d = 2 and x = 3.14159:
- s = 100
- x × s = 314.159
- round-half-up → 314
- 314 / 100 = 3.14
Negative decimal places
Setting decimal places to a negative integer moves the rounding point to the left of the decimal:
| Decimal places | Rounds to nearest |
|---|---|
| −1 | 10 |
| −2 | 100 |
| −3 | 1,000 |
Example. Round 3,749 to the nearest hundred (decimal places = −2):
- s = 10^(−2) = 0.01
- 3,749 × 0.01 = 37.49
- round(37.49) = 37
- 37 / 0.01 = 3,700
Floor vs. truncate
The distinction matters only for negative numbers:
| Input | Floor | Truncate |
|---|---|---|
| 2.7 | 2 | 2 |
| −2.7 | −3 | −2 |
| −0.1 | −1 | 0 |
Floor moves further from zero for negatives; truncate moves closer to zero.
Floating-point precision
Most decimal fractions are not exactly representable in IEEE 754 binary floating-point. For example, 3.55 × 10 stores internally as approximately 35.499999999999996, not exactly 35.5. This means the banker's rounding tie-breaking rule triggers only when the scaled value is an exact binary half-integer. For inputs that are not exact binary midpoints — including most "round" decimal fractions like 3.45 or 6.55 — the tie-breaking rule is not invoked and all modes give the same result.
This is an inherent property of binary floating-point, not a bug in the calculator. The behavior matches what you observe in Python, JavaScript, and every other IEEE 754 language.
Worked example: comparing all modes on 2.5
| Mode | Result |
|---|---|
| Round half up | 3 |
| Banker's rounding | 2 |
| Floor | 2 |
| Ceiling | 3 |
| Truncate | 2 |
This table shows why the rounding mode matters: a single input produces five different outputs depending on the rule applied.
Frequently Asked Questions (FAQ)
What is banker's rounding?
Banker's rounding (also called round-half-to-even) is a tie-breaking rule: when a number is exactly halfway between two choices, it rounds to the nearest even digit. For example, 2.5 → 2 (2 is even) and 3.5 → 4 (4 is even). This rule is used in IEEE 754 floating-point arithmetic and in many financial systems because it eliminates the systematic upward bias that plain round-half-up produces when large sets of half-values are summed.
How do I round to the nearest hundred?
Set Decimal places to −2. A negative value shifts the rounding point to the left of the decimal: −1 rounds to the nearest 10, −2 to the nearest 100, −3 to the nearest 1,000, and so on. For example, 3,749 with places = −2 gives 3,700 under round-half-up, because 3,749 is closer to 3,700 than to 3,800.
What is the difference between floor and truncate?
For positive numbers they produce the same result: floor(2.9) = trunc(2.9) = 2. They differ for negative numbers. Floor always rounds toward −∞, so floor(−2.9) = −3. Truncate always rounds toward zero, so trunc(−2.9) = −2. In other words, floor is the more negative answer and truncate is the answer closer to zero.
Why does 0.5 sometimes round down?
Under round-half-up, ties always go toward +∞, so 0.5 → 1 and −0.5 → 0. Under banker's rounding (round-half-to-even), ties go to whichever neighbor has an even last digit, so 0.5 → 0 (0 is even), 1.5 → 2, 2.5 → 2, 3.5 → 4. If you are used to the school rule "always round .5 up," banker's rounding can look wrong — but it is the IEEE 754 default, so it appears in spreadsheets, programming languages, and most calculators.
Recommended Next
Scientific Notation Converter
Convert any number to scientific notation (M × 10^E) or decode it back to standard decimal. Works for very large and very small numbers.