From 26d51fb2bf1ae6bb0f2c5f164647ee4a572b8d10 Mon Sep 17 00:00:00 2001 From: Darren Dale Date: Sun, 18 Apr 2010 14:02:31 +0000 Subject: correct a bug in fix() that was introduced in r8293 --- numpy/lib/tests/test_ufunclike.py | 1 + numpy/lib/ufunclike.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'numpy/lib') diff --git a/numpy/lib/tests/test_ufunclike.py b/numpy/lib/tests/test_ufunclike.py index 00c81bf43..e9c41d09c 100644 --- a/numpy/lib/tests/test_ufunclike.py +++ b/numpy/lib/tests/test_ufunclike.py @@ -48,6 +48,7 @@ class TestUfunclike(TestCase): res = ufl.fix(a, out) assert_equal(res, tgt) assert_equal(out, tgt) + assert_equal(ufl.fix(3.14), 3) def test_fix_with_subclass(self): class MyArray(nx.ndarray): diff --git a/numpy/lib/ufunclike.py b/numpy/lib/ufunclike.py index 734fd08be..8f81fe4b2 100644 --- a/numpy/lib/ufunclike.py +++ b/numpy/lib/ufunclike.py @@ -44,7 +44,7 @@ def fix(x, y=None): y1 = nx.floor(x) y2 = nx.ceil(x) if y is None: - y = y1 + y = nx.asanyarray(y1) y[...] = nx.where(x >= 0, y1, y2) return y -- cgit v1.2.1