Calculator
Example data table
Use these examples to test rounding combinations quickly.
| Dividend | Divisor | Target | Param | Mode | |
|---|---|---|---|---|---|
| 22/7 | 1 | dp | 3 | half_even | |
| 355/113 | 1 | sf | 5 | half_up | |
| 10 | 3 | dp | 0 | half_down | |
| -17 | 4 | step | 0.5 | toward_zero | |
| 2.75 | 0.2 | step | 0.25 | away_from_zero | |
| -5 | 2 | dp | 2 | up | |
| 1 | 8 | sf | 3 | down |
Dataset (append results)
| # | Dividend | Divisor | Target | Param | Mode | Exact | Rounded |
|---|
Formulas used
Quotient: q = a / b, with b ≠ 0.
Decimal places: round(q, dp) = toDecimalPlaces(q, dp, mode).
Significant figures: round_sf(q, s) = toSignificantDigits(q, s, mode).
Nearest step: round_step(q, h) = h × round(q / h, 0, mode).
Modes:
- Half up: ties go away from zero.
- Half to even: ties go to the nearest even.
- Half down: ties go toward zero.
- Down: toward −∞ (floor).
- Up: toward +∞ (ceiling).
- Toward zero: truncate fractional part.
- Away from zero: always increase magnitude.
How to use this calculator
- Enter a dividend and a divisor (fractions or decimals).
- Choose the rounding target: decimal places, significant figures, or step.
- Set the corresponding parameter: dp, sf, or step.
- Select a rounding mode to handle direction or midpoint ties.
- Press Calculate to see the exact quotient, rounded result, and steps.
- Optionally Add to dataset, then export CSV or PDF.
Rounding modes comparison (ties and negatives)
Illustrative outcomes for tie cases and signs; useful when choosing policy.
| Value | Target | Param | Half up | Half to even | Half down | Down (floor) | Up (ceiling) | Toward zero | Away from zero |
|---|---|---|---|---|---|---|---|---|---|
| 2.5 | dp | 0 | 3 | 2 | 2 | 2 | 3 | 2 | 3 |
| -2.5 | dp | 0 | -3 | -2 | -2 | -3 | -2 | -2 | -3 |
| 2.75 | step | 0.5 | 3.0 | 3.0 | 2.5 | 2.5 | 3.0 | 2.5 | 3.0 |
Note: step rounding computes k = q / h, rounds k per mode, then returns h×k.
Error metrics for rounded quotients
After rounding, quantify deviation using absolute and relative error. For quotient q and rounded value r:
- E_abs = |q − r|
- E_rel = E_abs / |q|, %E_rel = 100 × E_rel
| Dividend / Divisor | Target | Param | Mode | Exact q (≈) | Rounded r | |q − r| | % relative error (≈) |
|---|---|---|---|---|---|---|---|
| 22/7 | dp | 2 | half_even | 3.142857 | 3.14 | 0.002857 | 0.0909% |
| 355/113 | sf | 5 | half_up | 3.14159292 | 3.1416 | 0.00000708 | 0.000225% |
| 10/3 | step | 0.05 | half_even | 3.333333 | 3.35 | 0.016667 | 0.5000% |
Values are rounded for display; compute precisely in the calculator for your case.
Worked examples across targets
Quick reference showcasing different targets and modes on representative inputs.
| Dividend | Divisor | Target | Param | Mode | Rounded result (≈) | Notes |
|---|---|---|---|---|---|---|
| 22/7 | 1 | dp | 3 | half_even | 3.143 | Eight in 4th decimal rounds 3.142 → 3.143 |
| 355/113 | 1 | sf | 5 | half_up | 3.1416 | Five significant figures on high-precision ratio |
| 10 | 3 | dp | 0 | half_down | 3 | Below 3.5 so rounds down to 3 |
| -17 | 4 | step | 0.5 | toward_zero | -4.0 | k = -8.5 → toward zero gives -8 → ×0.5 = -4.0 |
| 2.75 | 1 | step | 0.5 | away_from_zero | 3.0 | Tie at 0.5 step goes away from zero |