logoalt Hacker News

KellyCriterionyesterday at 11:54 AM1 replyview on HN

Do not throw away any precision in finance/money computation, regardless what/ how you are doing it.

In C# e.g., there is type decimal for those computations.


Replies

lxgryesterday at 12:02 PM

You'll definitely have to throw it away at some point.

The art is in making those points well-defined and rare enough to not cause large discrepancies, but frequent enough to avoid ballooning arbitrary-precision numbers across databases and services that might not be able to handle them.

show 1 reply