When is min(a, b) != min(b, a)?
Russell E. Owen
rowen at cesmail.net
Wed Jan 23 15:45:27 EST 2008
In article <mailman.993.1201117814.896.python-list at python.org>,
Christian Heimes <lists at cheimes.de> wrote:
> Grant Edwards wrote:
> > In many applications (e.g. process control) propogating NaN
> > values are way too useful to avoid. Avoiding NaN would make a
> > lot of code far more complicated than would using them.
>
> NaNs are very useful for experienced power users but they are very
> confusing for newbies or developers without a numerical background.
>
> It's very easy to create an inf or nan in Python:
>
> inf = 1E+5000
> ninf = -inf
> nan = inf * 0.
>
> 1E5000 creates a nan because it is *much* bigger than DBL_MAX (around
> 1E+308). In fact it is even larger than LDBL_MAX (around 1E+4932).
Isn't it safer to use float("inf"), float("-inf") and float("nan") to
create the necessary items?
-- Russell
More information about the Python-list
mailing list