On Sat, Oct 29, 2016 at 11:44 PM, Stephan Hoyer <sho...@gmail.com> wrote:

> I'm have more mixed fillings on testing for NaNs. NaNs propagate, so
> explicit testing is rarely needed. Also, in numerical computing we usually
> work with arrays of NaN, so operator.exists() and all this nice syntax
> would not be a substitute for numpy.isnan or pandas.isnull.
>

NaN's *usually* propagate.  The NaN domain isn't actually closed under IEEE
754.

>>> nan, inf = float('nan'), float('inf')
>>> import math
>>> nan**0
1.0
>>> math.hypot(nan, inf)
inf
>>> min(1, nan)
1

The last one isn't really mandated by IEEE 754, and is weird when you
consider `min(nan, 1)`.


-- 
Keeping medicines from the bloodstreams of the sick; food
from the bellies of the hungry; books from the hands of the
uneducated; technology from the underdeveloped; and putting
advocates of freedom in prisons.  Intellectual property is
to the 21st century what the slave trade was to the 16th.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to