Bug Report Page

Big Java Brief Java
7th Edition 9th Edition
Section 4.2
At the end of the section, there should be:

Common Error 4.3 Roundoff Errors

Roundoff errors are a fact of life when calculating with floating-point numbers. You probably have encountered that phenomenon yourself with manual calculations. If you calculate 1 ⁄ 3 to two decimal places, you get 0.33. Multiplying again by 3, you obtain 0.99, not 1.00.

In the processor hardware, numbers are represented in the binary number system, using only digits 0 and 1. As with decimal numbers, you can get roundoff errors when binary digits are lost. They just may crop up at different places than you might expect.

In the binary system, there is no exact representation for 4.35, just as there is no exact representation for 1 ⁄ 3 in the decimal system. The representation used by the computer is just a little less than 4.35, so 100 times that value is just a little less than 435.

double price = 4.35;
double quantity = 100;
double total = price * quantity; // Should be 100 * 4.35 = 435
System.out.println(total); // Prints 434.99999999999999

You can deal with roundoff errors by rounding to the nearest integer (see Section 4.2.5) or by displaying a fixed number of digits after the decimal separator (see Section 4.3.2).

Section 4.2.5 Self Check 6
The solution to the fourth row should refer to Common Error 4.3 (see above).
Exercise P11.6
Append: “This file uses the UTF-8 encoding—see Special Topic 11.3.”
Section 15.2.3
In Table 3, rows 2 to 4 should be as follows:
Returns false because the iterator is at the end of the collection.
if (iter.hasPrevious())
   s = iter.previous();
hasPrevious returns true because the iterator is not at the beginning of the list. The call to previous returns "Sally", and the iterator is again at the beginning of the list. previous and hasPrevious are ListIterator methods.
The set method updates the last element returned by next or previous, without changing the iterator position. The list is now [Juliet].
Section 14.6.2
Change the last equation from T(n) = 1 + log2(n) to T(n) = T(1) + log2(n)
Section 23.3 WebGet.java
Change \n to \r\n (3x)

Thanks to Claire Bono, Cindy Johnson, Larry Morelli, Barry Nichols, and (your name might go here) for their bug reports and suggestions.

Bug Report Form

Please use this form to report any bugs that you find. Please check the list of known bugs first before you report a bug. Unfortunately, I do not have the time to respond personally to every report, but I do read them all and will post updates to this page. Thank you!

Your name:

Your email address:

Page number:

Problem description:

To protect against spam robots, please answer this simple math problem:
* =