From 6cb4d9b106c867b4bfb86b4abfd3dfc9e2709182 Mon Sep 17 00:00:00 2001 From: marload Date: Mon, 13 Jul 2020 18:14:13 +0900 Subject: BUG: linspace should round towards -infinity --- numpy/core/function_base.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'numpy/core/function_base.py') diff --git a/numpy/core/function_base.py b/numpy/core/function_base.py index f57e95742..34818e334 100644 --- a/numpy/core/function_base.py +++ b/numpy/core/function_base.py @@ -160,6 +160,9 @@ def linspace(start, stop, num=50, endpoint=True, retstep=False, dtype=None, if axis != 0: y = _nx.moveaxis(y, 0, axis) + + if _nx.issubdtype(dtype, np.integer): + y[y<0] = _nx.floor(y[y<0]) if retstep: return y.astype(dtype, copy=False), step -- cgit v1.2.1