[pypy-svn] r75869 - in pypy/branch/fast-forward/lib_pypy: . test2

benjamin at codespeak.net benjamin at codespeak.net
Tue Jul 6 01:21:04 CEST 2010


Author: benjamin
Date: Tue Jul  6 01:21:03 2010
New Revision: 75869

Removed:
   pypy/branch/fast-forward/lib_pypy/test2/
Modified:
   pypy/branch/fast-forward/lib_pypy/cmath.py
Log:
not in trunk

Modified: pypy/branch/fast-forward/lib_pypy/cmath.py
==============================================================================
--- pypy/branch/fast-forward/lib_pypy/cmath.py	(original)
+++ pypy/branch/fast-forward/lib_pypy/cmath.py	Tue Jul  6 01:21:03 2010
@@ -24,6 +24,23 @@
     return complex(real, imag)
 
 
+def phase(x):
+    x = complex(x)
+    return math.atan2(x.imag, x.real)
+
+
+def polar(x):
+    x = complex(x)
+    phi = math.atan2(x.imag, x.real)
+    r = abs(x)
+    return r, phi
+
+
+def rect(r, phi):
+    r, phi = complex(r), complex(phi)
+    return complex(r * math.cos(phi), r * math.sin(phi))
+
+
 def acos(x):
     """acos(x)
 



More information about the Pypy-commit mailing list