Java Reference
In-Depth Information
by zero does take place, the hardware in most computer systems pro-
duces an error response.
Algorithmic errors
Another type of errors, sometimes called algorithmic errors , relate to
flaws or intrinsic limitations of the real-world modeling performed by the
computer. One example is the approximation that may take place when
converting decimal numbers into binary format. Some decimal fractions
have an exact binary representation, as is the case with the values 0.5, 0.25,
0.125, 0.0625, and so on. Other decimal fractions have no exact binary
equivalent. In this case the computer uses the best binary approximation of
the decimal fraction according to the machine's word length. This approxi-
mation entails a roundoff error that can propagate in the calculations and
lead to incorrect results.
Numerical analysis is the discipline that deals with roundoff and trun-
cation errors of various algorithms. In this case the programmer must be
aware of the algorithms' error potential and use this knowledge to detect
erroneous results or to avoid ill-conditioned data sets. It is algorithmic er-
rors that are most often ignored by programmers.
Exceptions
The term exception is used to denote hardware, software, and algorithmic
errors. Thus, an exception can be broadly defined as any unusual event that
may require special handling. Exception handling refers to the special pro-
cessing operations that take place when an exception is detected. Raising
an exception refers to the actions that generate the exception itself. The en-
tire process can be described as follows:
1. A hardware, software, or algorithmic error takes place.
2. The error is detected and an exception is raised.
3. An exception handler provides the error response.
The detection of an error condition can originate in hardware or in
software. However, the exception itself is a software process. The error
handler can consist of many possible options, among them:
1. The error condition is ignored and the exception is cancelled.
2. The exception handler takes no specific action and passes the error condi-
tion along to another handler in the hierarchy.
3. The exception handler takes some action and passes the error condition
along to another handler in the hierarchy for additional response.
Search WWH ::




Custom Search