Skip to catalogue

minor units

Represent money using integer minor units or an appropriate decimal representation with an explicit currency.

Use this when Totals drift because prices are calculated with unsuitable arithmetic.

without the term

“Our order totals are sometimes off by a cent, like 0.1 plus 0.2 problems. Can you fix how we store and calculate money?”

with the term · How do you ask a model for minor units?

Represent these amounts with explicit currency and exact arithmetic. Test rounding, refunds, and totals without exceeding the numeric representation’s safe range.

XBlueskyLinkedIn

What is minor units?

Store amounts as integer minor units, such as cents, or as an exact decimal, always with the currency. Rounding happens at defined points, and currencies with zero or three decimal places are handled.

Why does minor units matter when vibe coding?

A generated calculation may mix currencies or silently round at different stages.

How do you do minor units?

Choose scale and rounding explicitly; verify sums, allocation, and currency-specific cases.

What goes wrong with minor units?

Assuming every currency has two decimal places or every integer fits safely in a JavaScript number.

adjacent

reviewed

report a correction