Numerics, NaNs, IEEE 754 and C99
gherron at islandtraining.com
Wed Jun 14 18:28:23 CEST 2006
> Grant Edwards a écrit :
>> The division by zero trap is really annoying. In my world the
>> right thing to do is to return Inf.
> Your world is flawed then, this is a big mistake. NaN is the only
> aceptable return value for a division by zero.
Sorry, but this is not true.
The IEEE standard specifies (plus or minus) infinity as the result of
division by zero. This makes sense since such is the limit of division
by a quantity that goes to zero. The IEEE standard then goes on to
define reasonable results for arithmetic between infinities and real
values. The production of, and arithmetic on, infinities is a choice
that any application may want allow or not.
More information about the Python-list