Java Reference
In-Depth Information
live with the nagging feeling that perhaps, one day, their income tax program
would produce a faulty return.
Ultimately, Intel had to cave in to public demand and replaced all defective chips,
at a cost of about 475 million dollars.
What do you think? Intel claims that the probability of the bug occurring in any
calculation is extremely smallÈŒsmaller than many chances you take every day,
such as driving to work in an automobile. Indeed, many users had used their
Pentium computers for many months without reporting any ill effects, and the
computations that Professor Nicely was doing are hardly examples of typical user
needs. As a result of its public relations blunder, Intel ended up paying a large
amount of money. Undoubtedly, some of that money was added to chip prices and
thus actually paid by Intel's customers. Also, a large number of processors, whose
manufacture consumed energy and caused some environmental impact, were
destroyed without benefiting anyone. Could Intel have been justified in wanting to
replace only the processors of those users who could reasonably be expected to
suffer an impact from the problem?
Suppose that, instead of stonewalling, Intel had offered you the choice of a free
replacement processor or a $200 rebate. What would you have done? Would you
have replaced your faulty chip, or would you have taken your chances and
pocketed the money?
4.2 Constants
In many programs, you need to use numerical constantsÈŒvalues that do not change
and that have a special significance for a computation.
A typical example for the use of constants is a computation that involves coin values,
such as the following:
payment = dollars + quarters * 0.25 + dimes * 0.1
+ nickels * 0.05 + pennies * 0.01;
Most of the code is self-documenting. However, the four numeric quantities, 0.25,
0.1, 0.05, and 0.01 are included in the arithmetic expression without any explanation.
Of course, in this case, you know that the value of a nickel is five cents, which
Search WWH ::




Custom Search