[Numpy-svn] r8438 - in trunk/numpy/core: src/umath tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue May 25 09:32:03 EDT 2010


Author: dhuard
Date: 2010-05-25 08:32:03 -0500 (Tue, 25 May 2010)
New Revision: 8438

Modified:
   trunk/numpy/core/src/umath/umathmodule.c.src
   trunk/numpy/core/tests/test_umath.py
Log:
Fix for ticket #866 (ldexp on 64 bits). Tested on ubuntu 64 bits.

Modified: trunk/numpy/core/src/umath/umathmodule.c.src
===================================================================
--- trunk/numpy/core/src/umath/umathmodule.c.src	2010-05-25 03:45:11 UTC (rev 8437)
+++ trunk/numpy/core/src/umath/umathmodule.c.src	2010-05-25 13:32:03 UTC (rev 8438)
@@ -188,9 +188,9 @@
 #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
 };
 

Modified: trunk/numpy/core/tests/test_umath.py
===================================================================
--- trunk/numpy/core/tests/test_umath.py	2010-05-25 03:45:11 UTC (rev 8437)
+++ trunk/numpy/core/tests/test_umath.py	2010-05-25 13:32:03 UTC (rev 8438)
@@ -353,6 +353,13 @@
         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)




More information about the Numpy-svn mailing list