money in cents

The practice of storing money as a whole number of the smallest unit, such as cents, so sums are exact.

In more detail

Integer arithmetic never rounds, so a basket total in cents is always right to the cent. Divide by one hundred only when displaying the value, and name the column for its unit, such as price_cents, so nobody mistakes it for pounds or dollars.

Example

(895 + 1250 + 2 * 340) / 100.0 AS display

Related terms

Taught in

References