8.15 Using BigDecimal for Precise Monetary Calculations

In earlier chapters, we demonstrated monetary calculations using values of type double. In Chapter 5, we discussed the fact that some double values are represented approximately. Any application that requires precise floating-point calculations—such as those in financial applications—should instead use class BigDecimal (from package java.math).

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.