In article <[EMAIL PROTECTED]>, Christophe <[EMAIL PROTECTED]> writes: |> |> > Now, can you explain why 1/0 => -Inf wouldn't work as well? I.e. why |> > are ALL of your zeroes, INCLUDING those that arise from subtractions, |> > are known to be positive? |> |> I would say that the most common reason people assume 1/0 = Inf is |> probably because they do not make use of negative numbers or they forgot |> they exist at all.
Usually the latter :-( Yes, if you are working with the non-negative real numbers (or even non-negative integers), then the best result of 1/0 is +infinity. Thus, if you are working with events, a count of zero is a true zero, but its inverse can reasonably be said to be +infinity. However, it is common for non-experts to assume that they are working in the non-negative real domain, because numbers are conventionally measured that way, but in fact that is not so. The use of elapsed times is one such "gotcha". I have seen quite a few programs that have assumed that elapsed times were always positive, and which have blown up when applied to real problems, where the measurement of an elapsed time may be negative. Hence, the SAFE approach is to make the inverse of all zeros a NaN. Regards, Nick Maclaren. -- http://mail.python.org/mailman/listinfo/python-list