3 ms·
Not that simple, though. That's the "division and rounding" method of the article: share a $.99 fee equally between two parties. That's either 49 cents each or
by throwaway744678 7y ago
Not that simple, though. That's the "division and rounding" method of the article: share a $.99 fee equally between two parties. That's either 49 cents each or 50 cents each if you're not careful. In both cases, where is the extra cent?
- ars 7y agoIf you use floats and rounded that one cent would disappear with them as well. Unless you're storing half cents in their account and not showing it. Which is perfectly legitimate by the way, because if you earn a fraction of a cent interest accumulated over a couple months that might actually be a cent and you have to pay it. The solution might be to store everything as 1/100 of a cent, as an integer.