In this track: Digital value and units
beginner · 3 MIN READ

Rounding versus truncation

Discarding digits and choosing the nearest display value are different operations.

LET’S PICTURE IT

A ruler can show a nearby mark or simply stop counting smaller divisions. Those two choices can disagree.

SEE IT FOR YOURSELF
The same native ether amount shown as ETH, Gwei and WeiETH1× 1 billionGWEI1000000000× 1 billionWEI1000000000000000000

1 ETH = 1000000000 Gwei = 1000000000000000000 Wei.

Same value · different units · native ether only

Truncation drops the remainder

For non-negative integers, 7 ÷ 2 with integer division gives 3 and leaves a remainder of 1. It does not produce 3.5. If a contract divides a payment among recipients, the treatment of leftover units needs an explicit rule.

Rounding chooses a convention

A display might round 0.019 ETH to 0.02 ETH at two decimal places. Truncating to two places gives 0.01 ETH. Neither short label is the full exact amount. Never feed an abbreviated preview back into transaction accounting as though it were exact.

Direction can matter economically

Rounding a debt down and rounding a credit up can create value imbalances when repeated. Financial contract code must define the intended direction and test edge cases. A small difference repeated many times is not automatically harmless.

Prefer explicit rejection in a converter

Our converter rejects meaningful digits beyond the smallest supported unit instead of silently rounding. For ETH that means at most eighteen decimal places. Keep the exact output available even when an interface offers a shorter visual preview.

TURN UNDERSTANDING INTO PRACTICEOpen the Wei / Gwei / ETH →
QUICK CHECK · NO PRESSURE

What is non-negative integer division 7 ÷ 2?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.