r/java • • Jun 14 '26

double, BigDecimal, or Fixed-Point?

https://blog.frankel.ch/bigdecimal-vs-double/
31 Upvotes

28 comments sorted by

View all comments

Show parent comment

13

u/akl78 Jun 14 '26

It’s gotta be longs. It’s surprisingly easy to hit rollover on 32-bit currency fields.

3

u/Winter-Appearance-14 Jun 14 '26

True depending on the application long is safer. In any case the truth is to always use integer operators.