On to Hydro

Ben Laurie ben@algroup.co.uk
Fri, 18 Aug 2000 16:00:45 +0100


Tyler Close 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? 

Because infinity is a perfectly sensible number that actually does come
up sometimes (consider the resistance of an open circuit, for example).

> If so, why is division of an integer by zero an exception?

Because there's no way to represent infinity as an integer.

BTW, you seem to be classifying all NaNs as infinity, which is wrong.
Indefinites cannot be ordered - I assume comparing an indefinite to
anything (even another NaN) should cause an exception.

Oh, and you have to check the difference between plus and minus
infinity.

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

Coming to ApacheCon Europe 2000? http://apachecon.com/