# On to Hydro

**hal@finney.org**
hal@finney.org

*Thu, 17 Aug 2000 18:10:39 -0700*

Tyler wrote:
>* I don't want to divert the conversation too much, but could anyone
*>* quickly tell me why division by 0 is even permitted (instead of
*>* throwing an exception)? Are there algorithms in which it makes sense
*>* to divide a number by zero? If so, why is division of an integer by
*>* zero an exception?
*
I found some examples of algorithms which benefit by allowing division
by zero at http://http.cs.berkeley.edu/~wkahan/ieee754status/ieee754.ps,
an article by William Kahan, inventor of the IEEE 754 floating point
standard.
Kahan gives some examples on pages 10-14 where allowing division by zero
simplifies calculations. If you disable the DBZ trap then it produces
positive or negative infinity as the answer, and in some cases this can
then be used in a meaningful way as a further operand, in particular as
a divisor.
The rest the article also offers insight into the motivation behind some
of the less used features of IEEE 754.
Hal