summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2010-05-25 13:32:03 +0000
committerdhuard <dhuard@localhost>2010-05-25 13:32:03 +0000
commitc7e5351461e4b0e43bf9b78b0c365e400bd39721 (patch)
tree594aaf1a0f7869be499d94c3335250afafab5394 /numpy
parentb9557767159a8a6b770195dd7b82feff5a6d4c5b (diff)
downloadnumpy-c7e5351461e4b0e43bf9b78b0c365e400bd39721.tar.gz
Fix for ticket #866 (ldexp on 64 bits). Tested on ubuntu 64 bits.
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)