Coverage for /usr/lib/python3/dist-packages/sympy/polys/domains/groundtypes.py: 87%
31 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
1"""Ground types for various mathematical domains in SymPy. """
3import builtins
4from sympy.external.gmpy import HAS_GMPY, factorial, sqrt
6PythonInteger = builtins.int
7PythonReal = builtins.float
8PythonComplex = builtins.complex
10from .pythonrational import PythonRational
12from sympy.core.numbers import (
13 igcdex as python_gcdex,
14 igcd2 as python_gcd,
15 ilcm as python_lcm,
16)
18from sympy.core.numbers import (Float as SymPyReal, Integer as SymPyInteger, Rational as SymPyRational)
21if HAS_GMPY == 2:
22 from gmpy2 import (
23 mpz as GMPYInteger,
24 mpq as GMPYRational,
25 numer as gmpy_numer,
26 denom as gmpy_denom,
27 gcdext as gmpy_gcdex,
28 gcd as gmpy_gcd,
29 lcm as gmpy_lcm,
30 qdiv as gmpy_qdiv,
31 )
32 gcdex = gmpy_gcdex
33 gcd = gmpy_gcd
34 lcm = gmpy_lcm
35else:
36 class _GMPYInteger:
37 def __init__(self, obj):
38 pass
40 class _GMPYRational:
41 def __init__(self, obj):
42 pass
44 GMPYInteger = _GMPYInteger
45 GMPYRational = _GMPYRational
46 gmpy_numer = None
47 gmpy_denom = None
48 gmpy_gcdex = None
49 gmpy_gcd = None
50 gmpy_lcm = None
51 gmpy_qdiv = None
52 gcdex = python_gcdex
53 gcd = python_gcd
54 lcm = python_lcm
57__all__ = [
58 'PythonInteger', 'PythonReal', 'PythonComplex',
60 'PythonRational',
62 'python_gcdex', 'python_gcd', 'python_lcm',
64 'SymPyReal', 'SymPyInteger', 'SymPyRational',
66 'GMPYInteger', 'GMPYRational', 'gmpy_numer',
67 'gmpy_denom', 'gmpy_gcdex', 'gmpy_gcd', 'gmpy_lcm',
68 'gmpy_qdiv',
70 'factorial', 'sqrt',
72 'GMPYInteger', 'GMPYRational',
73]