Briefle words · Code & architecture
Rounding mode
The explicit rule for which way to round a value that falls between two cents, such as half-up or half-even (banker's rounding).
Say it to an AI
Python function that totals a cart with tax, keeping money as integer minor units (cents) end to end. Compute tax with the Decimal type and an explicit rounding mode (ROUND_HALF_UP) to whole cents; only convert to dollars when formatting. No floats anywhere in the money path.
How an expert would brief the stronger version of “Cart total”.
See it
Try it as a puzzle →A grocery delivery team prototypes the checkout total calculation in a notebook.
Why: The tax here is 181.005 cents. B rounds it once to 181 with ROUND_HALF_UP and returns exactly 2375; A never rounds it, so its total is 23.75005 and only the print format's :.2f decides what the customer sees.
Related words
Room 5 · APIs & data
Learn “Rounding mode” in a five-minute lesson