[Numpy-discussion] proposal of new keywords for np.nan_to_num

Stefan van der Walt stefanv at berkeley.edu
Mon Apr 8 17:40:43 EDT 2019


On Thu, Apr 4, 2019, at 10:12, kikocorreoso wrote:
> I propose to add some keywords to nan_to_num function. The addition do not modify the actual behavior. Information related with this addition can be found in these links:
> https://github.com/numpy/numpy/pull/13219
> https://github.com/numpy/numpy/pull/9355

The added functionality seems fine, given what that function does already. But, a question for those who have seen its API put in place:

What is the rationale behind replacing infinities, when the function is called `nan_to_num`?

Also, this odd part of the docstring:

*NumPy uses the IEEE Standard for Binary Floating-Point for Arithmetic**
*
*(IEEE 754). This means that Not a Number is not equivalent to infinity.**
*

The meaning of this note isn't clear to me. Why would the reader suspect that Not a Number is equivalent to infinity? Do we detail somewhere how NaN's vs infinities typically arise in code?

Stéfan


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190408/6165c361/attachment.html>


More information about the NumPy-Discussion mailing list