Commits

Maciej Fijalkowski committed a045db5

add true divide

Comments (0)

Files changed (3)

pypy/module/micronumpy/__init__.py

         ("copysign", "copysign"),
         ("cos", "cos"),
         ("divide", "divide"),
+        ("true_divide", "true_divide"),
         ("equal", "equal"),
         ("exp", "exp"),
         ("fabs", "fabs"),

pypy/module/micronumpy/interp_ufuncs.py

             ("bitwise_or", "bitwise_or", 2, {"identity": 0,
                                              'int_only': True}),
             ("divide", "div", 2, {"promote_bools": True}),
+            ("true_divide", "div", 2, {"promote_to_float": True}),
             ("mod", "mod", 2, {"promote_bools": True}),
             ("power", "pow", 2, {"promote_bools": True}),
 

pypy/module/micronumpy/test/test_ufuncs.py

         assert count_reduce_items(a, 1) == 3
         assert count_reduce_items(a, (1, 2)) == 3 * 4
         
+    def test_true_divide(self):
+        from _numpypy import arange, array, true_divide
+        assert (true_divide(arange(3), array([2, 2, 2])) == array([0, 0.5, 1])).all()