Miscellaneous Functions

gmpy2.digits(x, base=10, prec=0, /) str

Return string representing a number x.

gmpy2.from_binary(bytes, /) mpz | xmpz | mpq | mpfr | mpc

Return a Python object from a byte sequence created by to_binary().

gmpy2.license() str

Return string giving license information.

gmpy2.mp_limbsize() int

Return the number of bits per limb.

gmpy2.mp_version() str

Return string giving current GMP version.

gmpy2.mpc_version() str

Return string giving current MPC version.

gmpy2.mpfr_version() str

Return string giving current MPFR version.

gmpy2.random_state(seed=0, /) object

Return new object containing state information for the random number generator. An optional integer can be specified as the seed value.

gmpy2.to_binary(x, /) bytes

Return a Python byte sequence that is a portable binary representation of a gmpy2 object x. The byte sequence can be passed to from_binary() to obtain an exact copy of x’s value. Raises a TypeError if x is not a gmpy2 object.

gmpy2.version() str

Return string giving current GMPY2 version.