Module 03 · Finance · The Plumbing That Moves Money · about 12 min to read
Continue where you left off ×
Half a Point a Day, Gone, integer minor units, rounding and currency exponents
IEEE-754 Decoder · Open board
How a float is stored, and why 0.1 + 0.2 comes out as 0.30000000000000004. That board explains the machine. This lesson is what a ledger does about it: which number to store for money, and where rounding is allowed to happen.
Education, not financial advice.
Before you start. From A Book You Never Erase, the append-only ledger, reversals and derived balances : a ledger is entries you only add to, and every balance is the sum of its entries, so any error in a single entry is in the balance forever. From Numbers for Real (signed ints, overflow, floating point) : a computer’s usual number with a decimal point, a float, stores most decimals only approximately, because 0.1 in binary repeats forever and has to be cut short. You do not need the bits. You need that one fact.
The idea in 30 seconds
Truncation chops digits instead of rounding, so its errors all point one way and pile up. That took the Vancouver index from about 1,099 to 524.811 in 22 months.
Floats store most decimal amounts approximately, so float totals miss by tiny amounts, and a ledger needs exactly equal, not nearly.
Ledgers store money as whole numbers of minor units, together with the currency.
The currency exponent says how many minor units make one main unit: 0 for the yen, 2 for the dollar, euro and rupee, 3 for the Kuwaiti and Bahraini dinars.
Round once, at the edge, with a rule whose errors cancel, like banker’s rounding. Split amounts by allocating the remainder so the parts add back to the whole.
Read the story
Lesson 45 of 58 in Finance
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson January 1982: an index that started at 1,000 Truncation: a meter that always reads low Why not just use decimals: floats are close, not exact Count the smallest coin: minor units Round once, at the edge, by a stated rule Terms it explains: truncation, minor unit, currency exponent, Banker's rounding, allocation.
Review Finance
Mark as read Saved in this browser, and to your account when you sign in.