On 12/26/19 2:10 PM, Andrew Barnert via Python-ideas wrote:
On Dec 26, 2019, at 10:58, Richard Damon <rich...@damon-family.org> wrote:
Note, that NaN values are somewhat rare in most programs, I think they can only come 
about by explicitly requesting them (like float("nan") ) or perhaps with some 
of the more advanced math packages
You can get them easily just from math itself.

Or, once you can get infinite values, you can easily get nan values with just 
basic arithmetic:

     >>> 1e1000 - 1e1000
     nan

I guess I didn't try hard enough to get a Nan. But once the Newbie has hit infinities, NO answer is right. The number could have been 1e1000 - 1e999 (and thus should be big) or 1e999 - 1e1000 (and thus should be very negative) or 1e1000 - 1e1000 (and thus should be zero), which is why we get a NaN here. If you are really worried about a median with values like this confusing someone, then we should handle the issue MUCH earlier, maybe even trapping the overflow with an error message unless taken out of 'newbie' mode.

--
Richard Damon
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/KY3QZUZH7BED6ROG27JXW2DXPM5S4FBB/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to