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 BigInteger and 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 ...

Get Java™ Number Cruncher: The Java Programmer's Guide to Numerical Computing now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.