[pypy-commit] pypy numpy-dtype-refactor: all tests pass! now it just needs to be made RPyhon
alex_gaynor
noreply at buildbot.pypy.org
Fri Nov 11 17:50:02 CET 2011
Author: Alex Gaynor <alex.gaynor at gmail.com>
Branch: numpy-dtype-refactor
Changeset: r49333:ce6baab20b88
Date: 2011-11-11 11:49 -0500
http://bitbucket.org/pypy/pypy/changeset/ce6baab20b88/
Log: all tests pass! now it just needs to be made RPyhon
diff --git a/pypy/module/micronumpy/interp_boxes.py b/pypy/module/micronumpy/interp_boxes.py
--- a/pypy/module/micronumpy/interp_boxes.py
+++ b/pypy/module/micronumpy/interp_boxes.py
@@ -48,6 +48,7 @@
descr_mul = _binop_impl("multiply")
descr_div = _binop_impl("divide")
descr_eq = _binop_impl("equal")
+ descr_lt = _binop_impl("less")
descr_rmul = _binop_right_impl("multiply")
@@ -115,7 +116,7 @@
pass
class W_Float32Box(W_FloatingBox):
- pass
+ get_dtype = dtype_getter("float32")
class W_Float64Box(W_FloatingBox):
get_dtype = dtype_getter("float64")
@@ -137,6 +138,7 @@
__rmul__ = interp2app(W_GenericBox.descr_rmul),
__eq__ = interp2app(W_GenericBox.descr_eq),
+ __lt__ = interp2app(W_GenericBox.descr_lt),
__neg__ = interp2app(W_GenericBox.descr_neg),
__abs__ = interp2app(W_GenericBox.descr_abs),
diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -256,6 +256,43 @@
def sin(self, v):
return math.sin(v)
+ @simple_unary_op
+ def cos(self, v):
+ return math.cos(v)
+
+ @simple_unary_op
+ def tan(self, v):
+ return math.tan(v)
+
+ @simple_unary_op
+ def arcsin(self, v):
+ if not -1.0 <= v <= 1.0:
+ return rfloat.NAN
+ return math.asin(v)
+
+ @simple_unary_op
+ def arccos(self, v):
+ if not -1.0 <= v <= 1.0:
+ return rfloat.NAN
+ return math.acos(v)
+
+ @simple_unary_op
+ def arctan(self, v):
+ return math.atan(v)
+
+ @simple_unary_op
+ def arcsinh(self, v):
+ return math.asinh(v)
+
+ @simple_unary_op
+ def arctanh(self, v):
+ if v == 1.0 or v == -1.0:
+ return math.copysign(rfloat.INFINITY, v)
+ if not -1.0 < v < 1.0:
+ return rfloat.NAN
+ return math.atanh(v)
+
+
class Float32(Float):
T = rffi.FLOAT
BoxType = interp_boxes.W_Float32Box
More information about the pypy-commit
mailing list