Skip to content

Comment on Decimal Is Sometimes Wrong

Comments

I enjoyed reading this! It's not always possible but finance data that translates directly into cents/euro-cents/pence/yen/etc is really nice to work with as integers. Obviously as soon as you need to divide that stops being such a solid strategy though. . .

Thanks! And you're right this is true for storage and at the transaction level where nothing smaller than, e.g., a penny is allowed to move or exist in the first place. But when you're working with interest rates and the main calculations involve multiplying by numbers < 1, you still have to figure out rounding.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.