Miscellaneous Functions
- gmpy2.from_binary(bytes, /) mpz | xmpz | mpq | mpfr | mpc
Return a Python object from a byte sequence created by
to_binary()
.
- 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 aTypeError
if x is not a gmpy2 object.