by irond13 · 7y ago · 0 comments
For example, interest accrued daily, but only ‘compounded’ monthly. In those cases, it is necessary to maintain far more than the 2 decimal places for the daily accruals.
The best type to use here would be BigDecimal or equivalent. These ultimately serialise to infinite length strings.
{ "amount": 12345, "exponent": 4 }
We could do that or something like: { "amount": "1.2345" }