summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/umath/umathmodule.c.src4
-rw-r--r--numpy/core/tests/test_umath.py7
2 files changed, 9 insertions, 2 deletions
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)