[pypy-svn] pypy cmath: (lac, arigo)
arigo
commits-noreply at bitbucket.org
Mon Jan 17 18:44:37 CET 2011
Author: Armin Rigo <arigo at tunes.org>
Branch: cmath
Changeset: r40804:b8d92cddb776
Date: 2011-01-17 18:37 +0100
http://bitbucket.org/pypy/pypy/changeset/b8d92cddb776/
Log: (lac, arigo)
sin(), cos(), tan().
diff --git a/pypy/module/cmath/__init__.py b/pypy/module/cmath/__init__.py
--- a/pypy/module/cmath/__init__.py
+++ b/pypy/module/cmath/__init__.py
@@ -18,6 +18,9 @@
'cosh': "Return the hyperbolic cosine of x.",
'sinh': "Return the hyperbolic sine of x.",
'tanh': "Return the hyperbolic tangent of x.",
+ 'cos': "Return the cosine of x.",
+ 'sin': "Return the sine of x.",
+ 'tan': "Return the tangent of x.",
}
diff --git a/pypy/module/cmath/interp_cmath.py b/pypy/module/cmath/interp_cmath.py
--- a/pypy/module/cmath/interp_cmath.py
+++ b/pypy/module/cmath/interp_cmath.py
@@ -431,3 +431,21 @@
real = tx * (1. + ty*ty) / denom
imag = ((ty / denom) * cx) * cx
return real, imag
+
+
+ at unaryfn
+def c_cos(x, y):
+ # cos(z) = cosh(iz)
+ return c_cosh(-y, x)
+
+ at unaryfn
+def c_sin(x, y):
+ # sin(z) = -i sinh(iz)
+ sx, sy = c_sinh(-y, x)
+ return sy, -sx
+
+ at unaryfn
+def c_tan(x, y):
+ # tan(z) = -i tanh(iz)
+ sx, sy = c_tanh(-y, x)
+ return sy, -sx
More information about the Pypy-commit
mailing list