2 ms·
The answer is never use floating point. Use BigDecimal for everything.
by wmf 4y ago
The answer is never use floating point. Use BigDecimal for everything.
- fedeb95 4y agoSure thing. But how should I use BigDecimal optimally when performing operations between them? Which MathContext to set when dealing with money and specifically converting between amounts and percentages? I can't seem to find references online. Ideally I'd like some theorem that proves me I need a precision up to n for say amounts in the order of magnitude of ten billions.