From c7e5351461e4b0e43bf9b78b0c365e400bd39721 Mon Sep 17 00:00:00 2001 From: dhuard Date: Tue, 25 May 2010 13:32:03 +0000 Subject: Fix for ticket #866 (ldexp on 64 bits). Tested on ubuntu 64 bits. --- numpy/core/src/umath/umathmodule.c.src | 4 ++-- numpy/core/tests/test_umath.py | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) (limited to 'numpy') diff --git a/numpy/core/src/umath/umathmodule.c.src b/numpy/core/src/umath/umathmodule.c.src index 802e45d77..9694f521d 100644 --- a/numpy/core/src/umath/umathmodule.c.src +++ b/numpy/core/src/umath/umathmodule.c.src @@ -188,9 +188,9 @@ static char ldexp_signatures[] = { #ifdef HAVE_LDEXPF PyArray_FLOAT, PyArray_INT, PyArray_FLOAT, #endif - PyArray_DOUBLE, PyArray_INT, PyArray_DOUBLE + PyArray_DOUBLE, PyArray_LONG, PyArray_DOUBLE #ifdef HAVE_LDEXPL - ,PyArray_LONGDOUBLE, PyArray_INT, PyArray_LONGDOUBLE + ,PyArray_LONGDOUBLE, PyArray_LONG, PyArray_LONGDOUBLE #endif }; diff --git a/numpy/core/tests/test_umath.py b/numpy/core/tests/test_umath.py index 999f8037f..21ee1a780 100644 --- a/numpy/core/tests/test_umath.py +++ b/numpy/core/tests/test_umath.py @@ -353,6 +353,13 @@ class TestArctan2SpecialValues(TestCase): assert_arctan2_isnan(np.nan, np.nan) +class TestLdexp(TestCase): + def test_ldexp(self): + assert_almost_equal(ncu.ldexp(2., 3), 16.) + assert_almost_equal(ncu.ldexp(np.array(2., np.float32), np.array(3, np.int16)), 16.) + assert_almost_equal(ncu.ldexp(np.array(2., np.float32), np.array(3, np.int32)), 16.) + assert_almost_equal(ncu.ldexp(np.array(2., np.float64), np.array(3, np.int32)), 16.) + class TestMaximum(TestCase): def test_reduce_complex(self): assert_equal(np.maximum.reduce([1,2j]),1) -- cgit v1.2.1