File: moduledef.py

package info (click to toggle)
pypy3 7.3.19%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 212,236 kB
  • sloc: python: 2,098,316; ansic: 540,565; sh: 21,462; asm: 14,419; cpp: 4,451; makefile: 4,209; objc: 761; xml: 530; exp: 499; javascript: 314; pascal: 244; lisp: 45; csh: 12; awk: 4
file content (51 lines) | stat: -rw-r--r-- 2,267 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51

# Package initialisation
from pypy.interpreter.mixedmodule import MixedModule

names_and_docstrings = {
    'sqrt': "Return the square root of x.",
    'acos': "Return the arc cosine of x.",
    'acosh': "Return the hyperbolic arc cosine of x.",
    'asin': "Return the arc sine of x.",
    'asinh': "Return the hyperbolic arc sine of x.",
    'atan': "Return the arc tangent of x.",
    'atanh': "Return the hyperbolic arc tangent of x.",
    'log': ("log(x[, base]) -> the logarithm of x to the given base.\n"
            "If the base not specified, returns the natural logarithm "
            "(base e) of x."),
    'log10': "Return the base-10 logarithm of x.",
    'exp': "Return the exponential value e**x.",
    '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.",
    'rect': "Convert from polar coordinates to rectangular coordinates.",
    'polar': ("polar(z) -> r: float, phi: float\n"
              "Convert a complex from rectangular coordinates "
              "to polar coordinates. r is\n"
              "the distance from 0 and phi the phase angle."),
    'phase': "Return argument, also known as the phase angle, of a complex.",
    'isinf': "Checks if the real or imaginary part of z is infinite.",
    'isnan': "Checks if the real or imaginary part of z is not a number (NaN)",
    'isfinite': "isfinite(z) -> bool\nReturn True if both the real and imaginary parts of z are finite, else False.",
}


class Module(MixedModule):
    appleveldefs = {
    }

    interpleveldefs = {
        'pi': 'space.newfloat(interp_cmath.pi)',
        'tau': 'space.newfloat(interp_cmath.tau)',
        'e':  'space.newfloat(interp_cmath.e)',
        'inf':  'space.newfloat(interp_cmath.inf)',
        'nan':  'space.newfloat(interp_cmath.nan)',
        'infj':  'space.newcomplex(0.0, interp_cmath.inf)',
        'nanj':  'space.newcomplex(0.0, interp_cmath.nan)',
        'isclose': 'interp_cmath.isclose',
    }
    interpleveldefs.update(dict([(name, 'interp_cmath.wrapped_' + name)
                                 for name in names_and_docstrings]))