Skip to content

Instantly share code, notes, and snippets.

@baruica
Forked from rgs/falsehood-prices.md
Created September 10, 2013 14:36
Show Gist options
  • Save baruica/6510329 to your computer and use it in GitHub Desktop.
Save baruica/6510329 to your computer and use it in GitHub Desktop.

Falsehoods programmers believe about prices

  1. You can store a price in a floating point variable.
  2. All currencies are subdivided in 1/100th units (like US dollar/cents, euro/eurocents etc.).
  3. All currencies are subdivided in decimal units (like dinar/fils)
  4. All currencies currently in circulation are subdivided in decimal units. (to exclude shillings, pennies)
  5. All currencies are subdivided.
  6. Prices can't have more precision than the smaller sub-unit of the currency. (e.g. gas prices)
  7. For any currency you can have a price of 1. (ZWL)
  8. Every country has its own currency.
  9. Countries have only one currency.
  10. Countries have only one currency currently in circulation.
  11. I'll only deal with currencies currently in circulation.
  12. All currencies have an ISO 4217 3-letter code.
  13. You always put the currency symbol after the price.
  14. You always put the currency symbol before the price.
  15. You always put the currency symbol either after, or before the price, never in the middle.
  16. For a given currency, you always, but always, put the symbol in the same place.
  17. OK. But if you only use the ISO 4217 currency codes, you always put it before the price.
  18. You can always use a dot (or a comma, etc.) as a decimal separator.
  19. You can always use a space (or a dot, or a comma, etc.) as a thousands separator.
  20. You separate big prices by grouping numbers in triplets (thousands).
  21. Prices at a single company will never range from five digits before the decimal to five digits after.
  22. Prices contains only digits and punctuation. (Germans can write 12,- €)
  23. A price can be at most 10^N for some value of N.
  24. Given two currencies, there is one and only one exchange rate between them at any given point in time.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment