Repository: numpy/numpy
Pull request: DOC: fixes issue #9326, by removing the statement.
This pull request fixes https://github.com/numpy/numpy/issues/9326

Problem statement:
DOC: Incorrect comment in the `common_type` docstring.
The docstring for `common_type` says:

    All input arrays can be safely cast to the returned dtype without loss
    of information.

This is not true.  When the inputs are integers, the common type returned is `numpy.float64`.  Sufficiently large integers cannot be cast to floating point exactly.  For example,

```
In [8]: a = np.array([2**63+1])

In [9]: a
Out[9]: array([9223372036854775809], dtype=uint64)

In [10]: np.common_type(a, a)
Out[10]: numpy.float64
```

Send `a` on a round-trip to `float64` and the back to its original type.  The result does not equal `a`.
```
In [11]: a.astype(np.float64).astype(a.dtype)
Out[11]: array([9223372036854775808], dtype=uint64)
```

This issue could probably be marked "easy fix": just remove the statement.

Hints from issue discussion:
I'd like to work on this. May I?

Commit message: DOC: fixes issue #9326 by removing the statement

Patch to review:
diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py
index 5202cebde1a8..8c0372372605 100644
--- a/numpy/lib/type_check.py
+++ b/numpy/lib/type_check.py
@@ -577,9 +577,6 @@ def common_type(*arrays):
     an integer array, the minimum precision type that is returned is a
     64-bit floating point dtype.
 
-    All input arrays can be safely cast to the returned dtype without loss
-    of information.
-
     Parameters
     ----------
     array1, array2, ... : ndarrays


Code review comments:
diff_hunk: @@ -577,9 +577,6 @@ def common_type(*arrays):
     an integer array, the minimum precision type that is returned is a
     64-bit floating point dtype.
 
-    All input arrays can be safely cast to the returned dtype without loss
-    of information.
path: numpy/lib/type_check.py
text: @user1:
Better would be to mention that this is true for all arrays except `int64` and `uint64`