| 1 |
|
| 2 |
|
| 3 |
from pypy.interpreter.mixedmodule import MixedModule |
| 4 |
|
| 5 |
names_and_docstrings = { |
| 6 |
'sqrt': "Return the square root of x.", |
| 7 |
'acos': "Return the arc cosine of x.", |
| 8 |
'acosh': "Return the hyperbolic arc cosine of x.", |
| 9 |
'asin': "Return the arc sine of x.", |
| 10 |
'asinh': "Return the hyperbolic arc sine of x.", |
| 11 |
'atan': "Return the arc tangent of x.", |
| 12 |
'atanh': "Return the hyperbolic arc tangent of x.", |
| 13 |
'log': ("log(x[, base]) -> the logarithm of x to the given base.\n" |
| 14 |
"If the base not specified, returns the natural logarithm " |
| 15 |
"(base e) of x."), |
| 16 |
'log10': "Return the base-10 logarithm of x.", |
| 17 |
'exp': "Return the exponential value e**x.", |
| 18 |
'cosh': "Return the hyperbolic cosine of x.", |
| 19 |
'sinh': "Return the hyperbolic sine of x.", |
| 20 |
'tanh': "Return the hyperbolic tangent of x.", |
| 21 |
'cos': "Return the cosine of x.", |
| 22 |
'sin': "Return the sine of x.", |
| 23 |
'tan': "Return the tangent of x.", |
| 24 |
'rect': "Convert from polar coordinates to rectangular coordinates.", |
| 25 |
'polar': ("polar(z) -> r: float, phi: float\n" |
| 26 |
"Convert a complex from rectangular coordinates " |
| 27 |
"to polar coordinates. r is\n" |
| 28 |
"the distance from 0 and phi the phase angle."), |
| 29 |
'phase': "Return argument, also known as the phase angle, of a complex.", |
| 30 |
'isinf': "Checks if the real or imaginary part of z is infinite.", |
| 31 |
'isnan': "Checks if the real or imaginary part of z is not a number (NaN)", |
| 32 |
'isfinite': "isfinite(z) -> bool\nReturn True if both the real and imaginary parts of z are finite, else False.", |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
class Module(MixedModule): |
| 37 |
appleveldefs = { |
| 38 |
} |
| 39 |
|
| 40 |
interpleveldefs = { |
| 41 |
'pi': 'space.newfloat(interp_cmath.pi)', |
| 42 |
'tau': 'space.newfloat(interp_cmath.tau)', |
| 43 |
'e': 'space.newfloat(interp_cmath.e)', |
| 44 |
'inf': 'space.newfloat(interp_cmath.inf)', |
| 45 |
'nan': 'space.newfloat(interp_cmath.nan)', |
| 46 |
'infj': 'space.newcomplex(0.0, interp_cmath.inf)', |
| 47 |
'nanj': 'space.newcomplex(0.0, interp_cmath.nan)', |
| 48 |
'isclose': 'interp_cmath.isclose', |
| 49 |
} |
| 50 |
interpleveldefs.update(dict([(name, 'interp_cmath.wrapped_' + name) |
| 51 |
for name in names_and_docstrings])) |