Free · No sign-up · Data stays local

Rounding Calculator

Exact decimal rounding across six modes — half up, banker's, ceiling, floor, toward zero and away from zero — with differences.

结果
—
与原值之差
—
小数位
—
六种模式对比

How to Use

  1. Enter the number and places

    123, -4.5, 0.001 and 1.2e-6 all work. Places 0–12 covers normal precision; negative values round to tens, hundreds and beyond.

  2. Pick a mode

    The result card follows your chosen mode, and the difference field shows result minus original — positive means it rounded up.

  3. Compare all six

    The table below lists every mode side by side and refreshes as you edit, so rule differences are visible at a glance.

FAQ

Why not just use JavaScript's Math.round?

It has three problems: it rounds .5 toward positive infinity instead of away from zero (Math.round(-1.5) is -1); binary floats store 0.145 as slightly less, so two places yields 0.14; and it only rounds to integers. This tool fixes all three.

How does banker's rounding decide?

On an exact half it looks at the parity of the retained digit: keep it if even, bump it if odd. So 2.5 → 2, 3.5 → 4, 0.5 → 0, 1.5 → 2. Long sums then avoid a systematic upward bias.

Ceiling versus away from zero?

Negative numbers expose it: ceiling of -2.5 is -2 (toward positive infinity), away from zero is -3 (larger magnitude). For positive values they agree, so the difference only shows below zero.

What do negative decimal places mean?

Rounding to the left. -2 rounds to the nearest hundred, so 1234.5678 becomes 1200 — handy for rough estimates and magnitude buckets.

More Online Tools