Chapter 12. Big Numbers
In the first three chapters of this book, we looked at the limitations of both integers and floating-point numbers. Of course, one major limitation is their precision—the
long integer type has 19 digits, and the
double floating-point type has about 17 significant digits. We also saw how the Java floating-point types only implement the default round to nearest rounding mode of the IEEE 754 floating-point standard.
Besides the primitive numeric types, Java implements big number, or arbitrary-precision, data types—the
BigDecimal classes in the
java.math package. These classes represent numbers that have arbitrary numbers of digits of precision, and they have methods to perform the common arithmetic operations ...