Numerics, NaNs, IEEE 754 and C99
Christophe
chris.cavalaria at free.fr
Wed Jun 14 12:28:40 EDT 2006
Grant Edwards a écrit :
> On 2006-06-14, Christophe <chris.cavalaria at free.fr> wrote:
>
>>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.
>
>
> You're probably right if you're talking about math, but I'm not
> doing math. I'm doing engineering. In all of the situations
> I've ever encountered, Inf was a much better choice.
You should have been more precise then : "In my ideal world, when
dividing a non zero value by a zero value, the result should be +Inf or
-Inf according the the sign rules"
On that point, you should also note that +0 and -0 are sometimes
considered two different floating point numbers in Python :)
More information about the Python-list
mailing list