Your balance is $0.30000000004

Common problems found in money-handling software

Sweetest spot on earth in the center — will rent

Arithmetical errors

Floating point

"Your balance is $" + (0.1 + 0.2)

Allocation

= round(0.99 / 2) + round(0.99 /2)
= round(0.495) + round(0.495)
= 0.5 + 0.5
= 1

Concurrency issues

Young programmer discovering the power of race conditions
#!/bin/bashseq 1 10 | \
xargs -n1 -P3 \
curl http://localhost/api/withdraw \
-X POST \
-H 'Content-Type: application/json' \
-d '{"from": "1234", "amount": 100}'

Unhandled remote failures

Null values

Partial processing

Silent failures

Missed captures

What now?

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store