'<' -> left shifted in field
│ │ │ '>' -> right shifted in field
│ │ │ @@ -211,46 +211,46 @@
│ │ │
│ │ │ conjugate() → mpc
│ │ │
Returns the conjugate of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -digits(base=10, prec=0, /) → tuple[tuple[str, int, int], tuple[str, int, int]]
│ │ │ +digits(base=10, prec=0, /) → tuple[tuple[str, int, int], tuple[str, int, int]]
│ │ │ Returns up to 'prec' digits in the given base. If 'prec' is 0, as many
│ │ │ digits that are available given c's precision are returned. 'base' must
│ │ │ be between 2 and 62. The result consists of 2 three-element tuples that
│ │ │ contain the mantissa, exponent, and number of bits of precision of the
│ │ │ real and imaginary components.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_finite() → bool
│ │ │ -Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ -an mpc
, return True
if both x.real and x.imag are finite.
│ │ │ +is_finite() → bool
│ │ │ +Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ +an mpc
, return True
if both x.real and x.imag are finite.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_infinite() → bool
│ │ │ -Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ -if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │ +is_infinite() → bool
│ │ │ +Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ +if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_nan() → bool
│ │ │ -Return True
if x is NaN (Not-A-Number) else False
.
│ │ │ +is_nan() → bool
│ │ │ +Return True
if x is NaN (Not-A-Number) else False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_zero() → bool
│ │ │ -Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ +is_zero() → bool
│ │ │ +
Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ and x.imag are equal to 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ imag
│ │ │ imaginary component
│ │ │ @@ -337,22 +337,22 @@
│ │ │ -
│ │ │ gmpy2.exp(x, /) → mpfr | mpc
│ │ │ Return the exponential of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_nan(x, /) → bool
│ │ │ -Return True
if x is NaN (Not-A-Number) else False
.
│ │ │ +gmpy2.is_nan(x, /) → bool
│ │ │ +Return True
if x is NaN (Not-A-Number) else False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_zero(x, /) → bool
│ │ │ -Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ +gmpy2.is_zero(x, /) → bool
│ │ │ +
Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ and x.imag are equal to 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.log(x, /) → mpfr | mpc
│ │ │ Return the natural logarithm of x.
│ │ │ @@ -387,15 +387,15 @@
│ │ │ -
│ │ │ gmpy2.phase(x, /) → mpfr
│ │ │ Return the phase angle, also known as argument, of a complex x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.polar(x, /) → tuple[mpfr, mpfr]
│ │ │ +gmpy2.polar(x, /) → tuple[mpfr, mpfr]
│ │ │ Return the polar coordinate form of a complex x that is in
│ │ │ rectangular form.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.proj(x, /) → mpc
│ │ │ @@ -419,15 +419,15 @@
│ │ │ -
│ │ │ gmpy2.sin(x, /) → mpfr | mpc
│ │ │ Return sine of x; x in radians.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.sin_cos(x, /) → tuple[mpfr | mpc, mpfr | mpc]
│ │ │ +gmpy2.sin_cos(x, /) → tuple[mpfr | mpc, mpfr | mpc]
│ │ │ Return a tuple containing the sine and cosine of x; x in radians.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.sinh(x, /) → mpfr | mpc
│ │ │ Return hyperbolic sine of x.
│ │ │ ├── html2text {}
│ │ │ │ @@ -77,15 +77,15 @@
│ │ │ │ 'j' as a suffix), separated by '+' and parsed the same as the _m_p_f_r
│ │ │ │ constructor does (but the base must be up to 36).
│ │ │ │ The precision can be specified by either a single number that is used for
│ │ │ │ both the real and imaginary components, or as a pair of different
│ │ │ │ precisions for the real and imaginary components. For every component,
│ │ │ │ the meaning of its precision value is the same as in the _m_p_f_r type
│ │ │ │ constructor.
│ │ │ │ - __format__(ffmmtt) → _s_t_r_
│ │ │ │ + __format__(ffmmtt) → str_
│ │ │ │ Return a Python string by formatting 'x' using the format string
│ │ │ │ 'fmt'. A valid format string consists of:
│ │ │ │ optional alignment code:
│ │ │ │ '<' -> left shifted in field '>' -> right
│ │ │ │ shifted in field '^' -> centered in field
│ │ │ │ optional leading sign code
│ │ │ │ '+' -> always display leading sign '-' -> only
│ │ │ │ @@ -103,32 +103,32 @@
│ │ │ │ 'a','A' -> hex format 'b' -> binary format
│ │ │ │ 'e','E' -> scientific format 'f','F' -> fixed
│ │ │ │ point format 'g','G' -> fixed or scientific
│ │ │ │ format
│ │ │ │ The default format is 'f'.
│ │ │ │ conjugate() → _m_p_c_
│ │ │ │ Returns the conjugate of x.
│ │ │ │ - digits(bbaassee==1100, pprreecc==00, //) → _t_u_p_l_e[_t_u_p_l_e[_s_t_r, _i_n_t, _i_n_t], _t_u_p_l_e[_s_t_r,
│ │ │ │ - _i_n_t, _i_n_t]]_
│ │ │ │ + digits(bbaassee==1100, pprreecc==00, //) → tuple[tuple[str, int, int], tuple[str,
│ │ │ │ + int, int]]_
│ │ │ │ Returns up to 'prec' digits in the given base. If 'prec' is 0, as
│ │ │ │ many digits that are available given c's precision are returned.
│ │ │ │ 'base' must be between 2 and 62. The result consists of 2 three-
│ │ │ │ element tuples that contain the mantissa, exponent, and number of
│ │ │ │ bits of precision of the real and imaginary components.
│ │ │ │ - is_finite() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is an actual number (i.e. non NaN or Infinity). If
│ │ │ │ - x is an _m_p_c, return _T_r_u_e if both x.real and x.imag are finite.
│ │ │ │ - is_infinite() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is +Infinity or -Infinity. If x is an _m_p_c, return
│ │ │ │ - _T_r_u_e if either x.real or x.imag is infinite. Otherwise return
│ │ │ │ - _F_a_l_s_e.
│ │ │ │ - is_nan() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is NaN (Not-A-Number) else _F_a_l_s_e.
│ │ │ │ - is_zero() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is equal to 0. If x is an _m_p_c, return _T_r_u_e if both
│ │ │ │ + is_finite() → bool_
│ │ │ │ + Return True if x is an actual number (i.e. non NaN or Infinity). If
│ │ │ │ + x is an _m_p_c, return True if both x.real and x.imag are finite.
│ │ │ │ + is_infinite() → bool_
│ │ │ │ + Return True if x is +Infinity or -Infinity. If x is an _m_p_c, return
│ │ │ │ + True if either x.real or x.imag is infinite. Otherwise return
│ │ │ │ + False.
│ │ │ │ + is_nan() → bool_
│ │ │ │ + Return True if x is NaN (Not-A-Number) else False.
│ │ │ │ + is_zero() → bool_
│ │ │ │ + Return True if x is equal to 0. If x is an _m_p_c, return True if both
│ │ │ │ x.real and x.imag are equal to 0.
│ │ │ │ imag_
│ │ │ │ imaginary component
│ │ │ │ precision_
│ │ │ │ precision in bits
│ │ │ │ rc_
│ │ │ │ return code
│ │ │ │ @@ -151,45 +151,45 @@
│ │ │ │ Return cosine of x; x in radians.
│ │ │ │ gmpy2.cosh(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return hyperbolic cosine of x.
│ │ │ │ gmpy2.div_2exp(xx, nn, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return x divided by 2**n.
│ │ │ │ gmpy2.exp(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return the exponential of x.
│ │ │ │ - gmpy2.is_nan(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is NaN (Not-A-Number) else _F_a_l_s_e.
│ │ │ │ - gmpy2.is_zero(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is equal to 0. If x is an _m_p_c, return _T_r_u_e if both
│ │ │ │ + gmpy2.is_nan(xx, //) → bool_
│ │ │ │ + Return True if x is NaN (Not-A-Number) else False.
│ │ │ │ + gmpy2.is_zero(xx, //) → bool_
│ │ │ │ + Return True if x is equal to 0. If x is an _m_p_c, return True if both
│ │ │ │ x.real and x.imag are equal to 0.
│ │ │ │ gmpy2.log(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return the natural logarithm of x.
│ │ │ │ gmpy2.log10(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return the base-10 logarithm of x.
│ │ │ │ gmpy2.mpc_random(rraannddoomm__ssttaattee, //) → _m_p_c_
│ │ │ │ Return uniformly distributed number in the unit square [0,1]x[0,1].
│ │ │ │ gmpy2.mul_2exp(xx, nn, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return x multiplied by 2**n.
│ │ │ │ gmpy2.norm(xx, //) → _m_p_f_r_
│ │ │ │ Return the norm of a complex x. The norm(x) is defined as x.real**2 +
│ │ │ │ x.imag**2. abs(x) is the square root of norm(x).
│ │ │ │ gmpy2.phase(xx, //) → _m_p_f_r_
│ │ │ │ Return the phase angle, also known as argument, of a complex x.
│ │ │ │ - gmpy2.polar(xx, //) → _t_u_p_l_e[_m_p_f_r, _m_p_f_r]_
│ │ │ │ + gmpy2.polar(xx, //) → tuple[_m_p_f_r, _m_p_f_r]_
│ │ │ │ Return the polar coordinate form of a complex x that is in rectangular
│ │ │ │ form.
│ │ │ │ gmpy2.proj(xx, //) → _m_p_c_
│ │ │ │ Returns the projection of a complex x on to the Riemann sphere.
│ │ │ │ gmpy2.rect(rr, pphhii, //) → _m_p_c_
│ │ │ │ Return the rectangular coordinate form of a complex number that is given
│ │ │ │ in polar form.
│ │ │ │ gmpy2.root_of_unity(nn, kk, //) → _m_p_c_
│ │ │ │ Return the n-th root of mpc(1) raised to the k-th power..
│ │ │ │ gmpy2.sin(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return sine of x; x in radians.
│ │ │ │ - gmpy2.sin_cos(xx, //) → _t_u_p_l_e[_m_p_f_r | _m_p_c, _m_p_f_r | _m_p_c]_
│ │ │ │ + gmpy2.sin_cos(xx, //) → tuple[_m_p_f_r | _m_p_c, _m_p_f_r | _m_p_c]_
│ │ │ │ Return a tuple containing the sine and cosine of x; x in radians.
│ │ │ │ gmpy2.sinh(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return hyperbolic sine of x.
│ │ │ │ gmpy2.sqrt(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return the square root of x.
│ │ │ │ gmpy2.tan(xx, //) → _m_p_f_r | _m_p_c_
│ │ │ │ Return tangent of x; x in radians.
│ │ ├── ./usr/share/doc/python-gmpy2-doc/html/mpfr.html
│ │ │ @@ -224,16 +224,16 @@
│ │ │ and/or exponent-part with an exponent marker 'e' or 'E' for bases up to
│ │ │ 10, else '@' in any base. In bases 2 and 16, the exponent prefix can also
│ │ │ be 'p' or 'P', in which case the exponent indicates
│ │ │ a multiplication by a power of 2 instead of the base. The value of
│ │ │ an exponent is always written in base 10. The fractional-part digits
│ │ │ are parsed the same as the mpz
type constructor
│ │ │ does and both the whole number and exponent-part optionally can be
│ │ │ -preceded by ‘+’ or ‘-’. Every input, accepted by the float
type
│ │ │ -constructor or the float.fromhex
method is also accepted.
│ │ │ +preceded by ‘+’ or ‘-’. Every input, accepted by the float
type
│ │ │ +constructor or the float.fromhex
method is also accepted.
│ │ │ If a precision greater than or equal to 2 is specified, then it
│ │ │ is used. A precision of 0 (the default) implies the precision of either
│ │ │ the specified context or the current context is used.
│ │ │ A precision of 1 minimizes the loss of precision by following
│ │ │ these rules:
│ │ │
│ │ │
│ │ │ @@ -241,15 +241,15 @@
│ │ │ precision of n is retained.
│ │ │ If n is an integer, then the precision is the bit length
│ │ │ of the integer.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -__format__(fmt) → str
│ │ │ +__format__(fmt) → str
│ │ │ Return a Python string by formatting 'x' using the format string
│ │ │ 'fmt'. A valid format string consists of:
│ │ │
│ │ │ optional alignment code:
│ │ │
│ │ │ '<' -> left shifted in field
│ │ │ '>' -> right shifted in field
│ │ │ @@ -280,22 +280,22 @@
│ │ │
│ │ │
│ │ │ The default format is '.6f'.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -as_integer_ratio() → tuple[mpz, mpz]
│ │ │ -Return the exact rational equivalent of an mpfr
. Value is a tuple
│ │ │ -for compatibility with Python's float.as_integer_ratio
.
│ │ │ +as_integer_ratio() → tuple[mpz, mpz]
│ │ │ +Return the exact rational equivalent of an mpfr
. Value is a tuple
│ │ │ +for compatibility with Python's float.as_integer_ratio
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -as_mantissa_exp() → tuple[mpz, mpz]
│ │ │ +as_mantissa_exp() → tuple[mpz, mpz]
│ │ │ Return the mantissa and exponent of an mpfr
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ as_simple_fraction(precision=0) → mpq
│ │ │ Return a simple rational approximation to x. The result will be
│ │ │ @@ -308,64 +308,64 @@
│ │ │ conjugate() → mpz
│ │ │
Return the conjugate of x (which is just a new reference to x since x is
│ │ │ not a complex number).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -digits(base=10, prec=0, /) → tuple[str, int, int]
│ │ │ +digits(base=10, prec=0, /) → tuple[str, int, int]
│ │ │ Returns up to 'prec' digits in the given base. If 'prec' is 0, as many
│ │ │ digits that are available are returned. No more digits than available
│ │ │ given x's precision are returned. 'base' must be between 2 and 62,
│ │ │ -inclusive. The result is a three element tuple
containing the mantissa,
│ │ │ +inclusive. The result is a three element tuple
containing the mantissa,
│ │ │ the exponent, and the number of bits of precision.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_finite() → bool
│ │ │ -Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ -an mpc
, return True
if both x.real and x.imag are finite.
│ │ │ +is_finite() → bool
│ │ │ +Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ +an mpc
, return True
if both x.real and x.imag are finite.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_infinite() → bool
│ │ │ -Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ -if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │ +is_infinite() → bool
│ │ │ +Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ +if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_integer() → bool
│ │ │ -Return True
if x is an integer; False
otherwise.
│ │ │ +is_integer() → bool
│ │ │ +Return True
if x is an integer; False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_nan() → bool
│ │ │ -Return True
if x is NaN (Not-A-Number) else False
.
│ │ │ +is_nan() → bool
│ │ │ +Return True
if x is NaN (Not-A-Number) else False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_regular() → bool
│ │ │ -Return True
if x is not zero, NaN, or Infinity; False
otherwise.
│ │ │ +is_regular() → bool
│ │ │ +Return True
if x is not zero, NaN, or Infinity; False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_signed() → bool
│ │ │ -Return True
if the sign bit of x is set.
│ │ │ +is_signed() → bool
│ │ │ +Return True
if the sign bit of x is set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_zero() → bool
│ │ │ -Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ +is_zero() → bool
│ │ │ +
Return True
if x is equal to 0. If x is an mpc
, return True
if both x.real
│ │ │ and x.imag are equal to 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ imag
│ │ │ imaginary component
│ │ │ @@ -429,15 +429,15 @@
│ │ │ gmpy2.check_range(x, /) → mpfr
│ │ │ Return a new mpfr
with exponent that lies within the current range
│ │ │ of emin and emax.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.cmp(x, y, /) → int
│ │ │ +gmpy2.cmp(x, y, /) → int
│ │ │ Return -1 if x < y; 0 if x = y; or 1 if x > y. Both x and y must be
│ │ │ integer, rational or real. Note: 0 is returned (and exception flag set)
│ │ │ if either argument is NaN.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -575,16 +575,16 @@
│ │ │
-
│ │ │ gmpy2.frac(x, /) → mpfr
│ │ │ Return fractional part of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.frexp(x, /) → tuple[int, mpfr]
│ │ │ -Return a tuple
containing the exponent and mantissa of x.
│ │ │ +gmpy2.frexp(x, /) → tuple[int, mpfr]
│ │ │ +Return a tuple
containing the exponent and mantissa of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.fsum(iterable, /) → mpfr
│ │ │ Return an accurate sum of the values in the iterable.
│ │ │
│ │ │ @@ -599,15 +599,15 @@
│ │ │ -
│ │ │ gmpy2.gamma_inc(a, x, /) → mpfr
│ │ │ Return (upper) incomplete gamma of a and x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.get_exp(x, /) → int
│ │ │ +gmpy2.get_exp(x, /) → int
│ │ │ Return the exponent of x. Returns 0 for NaN or Infinity and
│ │ │ sets the context.erange
flag of the current context and will
│ │ │ raise an exception if context.trap_erange
is set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -620,42 +620,42 @@
│ │ │ gmpy2.inf(n, /) → mpfr
│ │ │ Return an mpfr
initialized to Infinity with the same sign as n.
│ │ │ If n is not given, +Infinity is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_finite(x, /) → bool
│ │ │ -Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ -an mpc
, return True
if both x.real and x.imag are finite.
│ │ │ +gmpy2.is_finite(x, /) → bool
│ │ │ +Return True
if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ +an mpc
, return True
if both x.real and x.imag are finite.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_infinite(x, /) → bool
│ │ │ -Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ -if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │ +gmpy2.is_infinite(x, /) → bool
│ │ │ +Return True
if x is +Infinity or -Infinity. If x is an mpc
, return True
│ │ │ +if either x.real or x.imag is infinite. Otherwise return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_regular(x, /) → bool
│ │ │ -Return True
if x is not zero, NaN, or Infinity; False
otherwise.
│ │ │ +gmpy2.is_regular(x, /) → bool
│ │ │ +Return True
if x is not zero, NaN, or Infinity; False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_signed(x, /) → bool
│ │ │ -Return True
if the sign bit of x is set.
│ │ │ +gmpy2.is_signed(x, /) → bool
│ │ │ +Return True
if the sign bit of x is set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_unordered(x, y, /) → bool
│ │ │ -Return True
if either x and/or y is NaN.
│ │ │ +gmpy2.is_unordered(x, y, /) → bool
│ │ │ +Return True
if either x and/or y is NaN.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.j0(x, /) → mpfr
│ │ │ Return first kind Bessel function of order 0 of x.
│ │ │
│ │ │ @@ -671,16 +671,16 @@
│ │ │
gmpy2.jn(n,
x,
/) → mpfr
│ │ │
Return the first kind Bessel function of order n of x.
│ │ │ Note: the order of the arguments changed in gmpy2 2.2.0a2
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.lgamma(x, /) → tuple[mpfr, int]
│ │ │ -Return a tuple
containing the logarithm of the absolute value of
│ │ │ +gmpy2.lgamma(x, /) → tuple[mpfr, int]
│ │ │ +
Return a tuple
containing the logarithm of the absolute value of
│ │ │ gamma(x) and the sign of gamma(x)
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.li2(x, /) → mpfr
│ │ │ Return real part of dilogarithm of x.
│ │ │ @@ -718,28 +718,28 @@
│ │ │ Return the minimum number of x and y. If x and y are not mpfr
, they are
│ │ │ converted to mpfr
. The result is rounded to match the current context.
│ │ │ If only one of x or y is a number, then that number is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.modf(x, /) → tuple[mpfr, mpfr]
│ │ │ -Return a tuple
containing the integer and fractional portions
│ │ │ +gmpy2.modf(x, /) → tuple[mpfr, mpfr]
│ │ │ +
Return a tuple
containing the integer and fractional portions
│ │ │ of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.mpfr_from_old_binary(string, /) → mpfr
│ │ │ Return an mpfr
from a GMPY 1.x binary mpf format.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.mpfr_grandom(random_state, /) → tuple[mpfr, mpfr]
│ │ │ +gmpy2.mpfr_grandom(random_state, /) → tuple[mpfr, mpfr]
│ │ │ Return two random numbers with gaussian distribution.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.mpfr_nrandom(random_state, /)
│ │ │ Return a random number with gaussian distribution.
│ │ │ @@ -794,16 +794,16 @@
│ │ │ gmpy2.remainder(x, y, /) → mpfr
│ │ │ Return x - n*y where n is the integer quotient of x/y, rounded to
│ │ │ the nearest integer and ties rounded to even.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.remquo(x, y, /) → tuple[mpfr, int]
│ │ │ -Return a tuple
containing the remainder(x,y) and the low bits of the
│ │ │ +gmpy2.remquo(x, y, /) → tuple[mpfr, int]
│ │ │ +
Return a tuple
containing the remainder(x,y) and the low bits of the
│ │ │ quotient.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.rint(x, /) → mpfr
│ │ │ Return x rounded to the nearest integer using the current rounding
│ │ │ @@ -890,27 +890,27 @@
│ │ │ of the current context and either return the original value or raise
│ │ │ an exception if context.trap_erange
is set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.set_sign(x, s, /) → mpfr
│ │ │ -If s is True
, then return x with the sign bit set.
│ │ │ +If s is True
, then return x with the sign bit set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.sign(x, /) → int
│ │ │ +gmpy2.sign(x, /) → int
│ │ │ Return -1 if x < 0, 0 if x == 0, or +1 if x >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.sinh_cosh(x, /) → tuple[mpfr, mpfr]
│ │ │ -Return a tuple
containing the hyperbolic sine and cosine of x.
│ │ │ +gmpy2.sinh_cosh(x, /) → tuple[mpfr, mpfr]
│ │ │ +Return a tuple
containing the hyperbolic sine and cosine of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.trunc(x, /) → mpfr
│ │ │ Return an mpfr
that is x truncated towards 0. Same as
│ │ │ x.floor() if x>=0 or x.ceil() if x<0.
│ │ │ @@ -946,50 +946,50 @@
│ │ │ -
│ │ │ gmpy2.zeta(x, /) → mpfr
│ │ │ Return Riemann zeta of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.get_max_precision() → int
│ │ │ +gmpy2.get_max_precision() → int
│ │ │ Return the maximum bits of precision that can be used for calculations.
│ │ │ Note: to allow extra precision for intermediate calculations, avoid
│ │ │ setting precision close the maximum precision.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.get_emax_max() → int
│ │ │ +gmpy2.get_emax_max() → int
│ │ │ Return the maximum possible exponent that can be set for mpfr
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.get_emin_min() → int
│ │ │ +gmpy2.get_emin_min() → int
│ │ │ Return the minimum possible exponent that can be set for mpfr
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.copy_sign(x, y, /) → mpfr
│ │ │ Return an mpfr
composed of x with the sign of y.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.can_round(b, err, rnd1, rnd2, prec, /) → bool
│ │ │ +gmpy2.can_round(b, err, rnd1, rnd2, prec, /) → bool
│ │ │ Let b be an approximation to an unknown number x that is rounded
│ │ │ according to rnd1. Assume the b has an error at most two to the power
│ │ │ -of E(b)-err where E(b) is the exponent of b. Then return True
if x
│ │ │ +of E(b)-err where E(b) is the exponent of b. Then return True
if x
│ │ │ can be rounded correctly to prec bits with rounding mode rnd2.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.free_cache() → None
│ │ │ +gmpy2.free_cache() → None
│ │ │ Free the internal cache of constants maintained by MPFR.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -142,25 +142,25 @@
│ │ │ │ A string can be with fraction-part (with a period as a separator) and/or
│ │ │ │ exponent-part with an exponent marker 'e' or 'E' for bases up to 10, else
│ │ │ │ '@' in any base. In bases 2 and 16, the exponent prefix can also be 'p'
│ │ │ │ or 'P', in which case the exponent indicates a multiplication by a power
│ │ │ │ of 2 instead of the base. The value of an exponent is always written in
│ │ │ │ base 10. The fractional-part digits are parsed the same as the _m_p_z type
│ │ │ │ constructor does and both the whole number and exponent-part optionally
│ │ │ │ - can be preceded by ‘+’ or ‘-’. Every input, accepted by the _f_l_o_a_t type
│ │ │ │ - constructor or the _f_l_o_a_t_._f_r_o_m_h_e_x method is also accepted.
│ │ │ │ + can be preceded by ‘+’ or ‘-’. Every input, accepted by the float type
│ │ │ │ + constructor or the float.fromhex method is also accepted.
│ │ │ │ If a precision greater than or equal to 2 is specified, then it is used.
│ │ │ │ A precision of 0 (the default) implies the precision of either the
│ │ │ │ specified context or the current context is used. A precision of 1
│ │ │ │ minimizes the loss of precision by following these rules:
│ │ │ │ 1. If n is a radix-2 floating point number, then the full
│ │ │ │ precision of n is retained.
│ │ │ │ 2. If n is an integer, then the precision is the bit length
│ │ │ │ of the integer.
│ │ │ │ - __format__(ffmmtt) → _s_t_r_
│ │ │ │ + __format__(ffmmtt) → str_
│ │ │ │ Return a Python string by formatting 'x' using the format string
│ │ │ │ 'fmt'. A valid format string consists of:
│ │ │ │ optional alignment code:
│ │ │ │ '<' -> left shifted in field '>' -> right
│ │ │ │ shifted in field '^' -> centered in field
│ │ │ │ optional leading sign code
│ │ │ │ '+' -> always display leading sign '-' -> only
│ │ │ │ @@ -173,49 +173,49 @@
│ │ │ │ zero 'Z' -> round toward zero 'N' -> round to
│ │ │ │ nearest
│ │ │ │ optional conversion code:
│ │ │ │ 'a','A' -> hex format 'b' -> binary format
│ │ │ │ 'e','E' -> scientific format 'f','F' -> fixed
│ │ │ │ point format 'g','G' -> fixed or float format
│ │ │ │ The default format is '.6f'.
│ │ │ │ - as_integer_ratio() → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ - Return the exact rational equivalent of an _m_p_f_r. Value is a _t_u_p_l_e
│ │ │ │ - for compatibility with Python's _f_l_o_a_t_._a_s___i_n_t_e_g_e_r___r_a_t_i_o.
│ │ │ │ - as_mantissa_exp() → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + as_integer_ratio() → tuple[_m_p_z, _m_p_z]_
│ │ │ │ + Return the exact rational equivalent of an _m_p_f_r. Value is a tuple
│ │ │ │ + for compatibility with Python's float.as_integer_ratio.
│ │ │ │ + as_mantissa_exp() → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the mantissa and exponent of an _m_p_f_r.
│ │ │ │ as_simple_fraction(pprreecciissiioonn==00) → _m_p_q_
│ │ │ │ Return a simple rational approximation to x. The result will be
│ │ │ │ accurate to 'precision' bits. If 'precision' is 0, the precision of
│ │ │ │ 'x' will be used.
│ │ │ │ conjugate() → _m_p_z_
│ │ │ │ Return the conjugate of x (which is just a new reference to x since
│ │ │ │ x is not a complex number).
│ │ │ │ - digits(bbaassee==1100, pprreecc==00, //) → _t_u_p_l_e[_s_t_r, _i_n_t, _i_n_t]_
│ │ │ │ + digits(bbaassee==1100, pprreecc==00, //) → tuple[str, int, int]_
│ │ │ │ Returns up to 'prec' digits in the given base. If 'prec' is 0, as
│ │ │ │ many digits that are available are returned. No more digits than
│ │ │ │ available given x's precision are returned. 'base' must be between
│ │ │ │ - 2 and 62, inclusive. The result is a three element _t_u_p_l_e containing
│ │ │ │ + 2 and 62, inclusive. The result is a three element tuple containing
│ │ │ │ the mantissa, the exponent, and the number of bits of precision.
│ │ │ │ - is_finite() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is an actual number (i.e. non NaN or Infinity). If
│ │ │ │ - x is an _m_p_c, return _T_r_u_e if both x.real and x.imag are finite.
│ │ │ │ - is_infinite() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is +Infinity or -Infinity. If x is an _m_p_c, return
│ │ │ │ - _T_r_u_e if either x.real or x.imag is infinite. Otherwise return
│ │ │ │ - _F_a_l_s_e.
│ │ │ │ - is_integer() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is an integer; _F_a_l_s_e otherwise.
│ │ │ │ - is_nan() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is NaN (Not-A-Number) else _F_a_l_s_e.
│ │ │ │ - is_regular() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is not zero, NaN, or Infinity; _F_a_l_s_e otherwise.
│ │ │ │ - is_signed() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if the sign bit of x is set.
│ │ │ │ - is_zero() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is equal to 0. If x is an _m_p_c, return _T_r_u_e if both
│ │ │ │ + is_finite() → bool_
│ │ │ │ + Return True if x is an actual number (i.e. non NaN or Infinity). If
│ │ │ │ + x is an _m_p_c, return True if both x.real and x.imag are finite.
│ │ │ │ + is_infinite() → bool_
│ │ │ │ + Return True if x is +Infinity or -Infinity. If x is an _m_p_c, return
│ │ │ │ + True if either x.real or x.imag is infinite. Otherwise return
│ │ │ │ + False.
│ │ │ │ + is_integer() → bool_
│ │ │ │ + Return True if x is an integer; False otherwise.
│ │ │ │ + is_nan() → bool_
│ │ │ │ + Return True if x is NaN (Not-A-Number) else False.
│ │ │ │ + is_regular() → bool_
│ │ │ │ + Return True if x is not zero, NaN, or Infinity; False otherwise.
│ │ │ │ + is_signed() → bool_
│ │ │ │ + Return True if the sign bit of x is set.
│ │ │ │ + is_zero() → bool_
│ │ │ │ + Return True if x is equal to 0. If x is an _m_p_c, return True if both
│ │ │ │ x.real and x.imag are equal to 0.
│ │ │ │ imag_
│ │ │ │ imaginary component
│ │ │ │ precision_
│ │ │ │ precision in bits
│ │ │ │ rc_
│ │ │ │ return code
│ │ │ │ @@ -231,15 +231,15 @@
│ │ │ │ gmpy2.cbrt(xx, //) → _m_p_f_r_
│ │ │ │ Return the cube root of x.
│ │ │ │ gmpy2.ceil(xx, //) → _m_p_f_r_
│ │ │ │ Return an 'mpfr' that is the smallest integer >= x.
│ │ │ │ gmpy2.check_range(xx, //) → _m_p_f_r_
│ │ │ │ Return a new _m_p_f_r with exponent that lies within the current range of
│ │ │ │ emin and emax.
│ │ │ │ - gmpy2.cmp(xx, yy, //) → _i_n_t_
│ │ │ │ + gmpy2.cmp(xx, yy, //) → int_
│ │ │ │ Return -1 if x < y; 0 if x = y; or 1 if x > y. Both x and y must be
│ │ │ │ integer, rational or real. Note: 0 is returned (and exception flag set)
│ │ │ │ if either argument is NaN.
│ │ │ │ gmpy2.const_catalan(pprreecciissiioonn==00) → _m_p_f_r_
│ │ │ │ Return the catalan constant using the specified precision. If no
│ │ │ │ precision is specified, the default precision is used.
│ │ │ │ gmpy2.const_euler(pprreecciissiioonn==00) → _m_p_f_r_
│ │ │ │ @@ -285,52 +285,52 @@
│ │ │ │ Return correctly rounded result of (x * y) + (z + t).
│ │ │ │ gmpy2.fmms(xx, yy, zz, tt, //) → _m_p_f_r_
│ │ │ │ Return correctly rounded result of (x * y) - (z + t).
│ │ │ │ gmpy2.fmod(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return x - n*y where n is the integer quotient of x/y, rounded to 0.
│ │ │ │ gmpy2.frac(xx, //) → _m_p_f_r_
│ │ │ │ Return fractional part of x.
│ │ │ │ - gmpy2.frexp(xx, //) → _t_u_p_l_e[_i_n_t, _m_p_f_r]_
│ │ │ │ - Return a _t_u_p_l_e containing the exponent and mantissa of x.
│ │ │ │ + gmpy2.frexp(xx, //) → tuple[int, _m_p_f_r]_
│ │ │ │ + Return a tuple containing the exponent and mantissa of x.
│ │ │ │ gmpy2.fsum(iitteerraabbllee, //) → _m_p_f_r_
│ │ │ │ Return an accurate sum of the values in the iterable.
│ │ │ │ gmpy2.gamma(xx, //) → _m_p_f_r_
│ │ │ │ Return gamma of x.
│ │ │ │ gmpy2.gamma_inc(aa, xx, //) → _m_p_f_r_
│ │ │ │ Return (upper) incomplete gamma of a and x.
│ │ │ │ - gmpy2.get_exp(xx, //) → _i_n_t_
│ │ │ │ + gmpy2.get_exp(xx, //) → int_
│ │ │ │ Return the exponent of x. Returns 0 for NaN or Infinity and sets the
│ │ │ │ _c_o_n_t_e_x_t_._e_r_a_n_g_e flag of the current context and will raise an exception if
│ │ │ │ _c_o_n_t_e_x_t_._t_r_a_p___e_r_a_n_g_e is set.
│ │ │ │ gmpy2.hypot(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return square root of (x**2 + y**2).
│ │ │ │ gmpy2.inf(nn, //) → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r initialized to Infinity with the same sign as n. If n is
│ │ │ │ not given, +Infinity is returned.
│ │ │ │ - gmpy2.is_finite(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ │ - an _m_p_c, return _T_r_u_e if both x.real and x.imag are finite.
│ │ │ │ - gmpy2.is_infinite(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is +Infinity or -Infinity. If x is an _m_p_c, return _T_r_u_e
│ │ │ │ - if either x.real or x.imag is infinite. Otherwise return _F_a_l_s_e.
│ │ │ │ - gmpy2.is_regular(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is not zero, NaN, or Infinity; _F_a_l_s_e otherwise.
│ │ │ │ - gmpy2.is_signed(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if the sign bit of x is set.
│ │ │ │ - gmpy2.is_unordered(xx, yy, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if either x and/or y is NaN.
│ │ │ │ + gmpy2.is_finite(xx, //) → bool_
│ │ │ │ + Return True if x is an actual number (i.e. non NaN or Infinity). If x is
│ │ │ │ + an _m_p_c, return True if both x.real and x.imag are finite.
│ │ │ │ + gmpy2.is_infinite(xx, //) → bool_
│ │ │ │ + Return True if x is +Infinity or -Infinity. If x is an _m_p_c, return True
│ │ │ │ + if either x.real or x.imag is infinite. Otherwise return False.
│ │ │ │ + gmpy2.is_regular(xx, //) → bool_
│ │ │ │ + Return True if x is not zero, NaN, or Infinity; False otherwise.
│ │ │ │ + gmpy2.is_signed(xx, //) → bool_
│ │ │ │ + Return True if the sign bit of x is set.
│ │ │ │ + gmpy2.is_unordered(xx, yy, //) → bool_
│ │ │ │ + Return True if either x and/or y is NaN.
│ │ │ │ gmpy2.j0(xx, //) → _m_p_f_r_
│ │ │ │ Return first kind Bessel function of order 0 of x.
│ │ │ │ gmpy2.j1(xx, //) → _m_p_f_r_
│ │ │ │ Return first kind Bessel function of order 1 of x.
│ │ │ │ gmpy2.jn(nn, xx, //) → _m_p_f_r_
│ │ │ │ Return the first kind Bessel function of order n of x. Note: the order of
│ │ │ │ the arguments changed in gmpy2 2.2.0a2
│ │ │ │ - gmpy2.lgamma(xx, //) → _t_u_p_l_e[_m_p_f_r, _i_n_t]_
│ │ │ │ - Return a _t_u_p_l_e containing the logarithm of the absolute value of gamma(x)
│ │ │ │ + gmpy2.lgamma(xx, //) → tuple[_m_p_f_r, int]_
│ │ │ │ + Return a tuple containing the logarithm of the absolute value of gamma(x)
│ │ │ │ and the sign of gamma(x)
│ │ │ │ gmpy2.li2(xx, //) → _m_p_f_r_
│ │ │ │ Return real part of dilogarithm of x.
│ │ │ │ gmpy2.lngamma(xx, //) → _m_p_f_r_
│ │ │ │ Return natural logarithm of gamma(x).
│ │ │ │ gmpy2.log1p(xx, //) → _m_p_f_r_
│ │ │ │ Return natural logarithm of (1+x).
│ │ │ │ @@ -340,19 +340,19 @@
│ │ │ │ Return the maximum number of x and y. If x and y are not _m_p_f_r, they are
│ │ │ │ converted to _m_p_f_r. The result is rounded to match the current context. If
│ │ │ │ only one of x or y is a number, then that number is returned.
│ │ │ │ gmpy2.minnum(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return the minimum number of x and y. If x and y are not _m_p_f_r, they are
│ │ │ │ converted to _m_p_f_r. The result is rounded to match the current context. If
│ │ │ │ only one of x or y is a number, then that number is returned.
│ │ │ │ - gmpy2.modf(xx, //) → _t_u_p_l_e[_m_p_f_r, _m_p_f_r]_
│ │ │ │ - Return a _t_u_p_l_e containing the integer and fractional portions of x.
│ │ │ │ + gmpy2.modf(xx, //) → tuple[_m_p_f_r, _m_p_f_r]_
│ │ │ │ + Return a tuple containing the integer and fractional portions of x.
│ │ │ │ gmpy2.mpfr_from_old_binary(ssttrriinngg, //) → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r from a GMPY 1.x binary mpf format.
│ │ │ │ - gmpy2.mpfr_grandom(rraannddoomm__ssttaattee, //) → _t_u_p_l_e[_m_p_f_r, _m_p_f_r]_
│ │ │ │ + gmpy2.mpfr_grandom(rraannddoomm__ssttaattee, //) → tuple[_m_p_f_r, _m_p_f_r]_
│ │ │ │ Return two random numbers with gaussian distribution.
│ │ │ │ gmpy2.mpfr_nrandom(rraannddoomm__ssttaattee, //)_
│ │ │ │ Return a random number with gaussian distribution.
│ │ │ │ gmpy2.mpfr_random(rraannddoomm__ssttaattee, //) → _m_p_f_r_
│ │ │ │ Return uniformly distributed number between [0,1].
│ │ │ │ gmpy2.nan() → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r initialized to NaN (Not-A-Number).
│ │ │ │ @@ -367,16 +367,16 @@
│ │ │ │ Return the reciprocal of the square root of x.
│ │ │ │ gmpy2.reldiff(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return the relative difference between x and y. Result is equal to abs(x-
│ │ │ │ y)/x.
│ │ │ │ gmpy2.remainder(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return x - n*y where n is the integer quotient of x/y, rounded to the
│ │ │ │ nearest integer and ties rounded to even.
│ │ │ │ - gmpy2.remquo(xx, yy, //) → _t_u_p_l_e[_m_p_f_r, _i_n_t]_
│ │ │ │ - Return a _t_u_p_l_e containing the remainder(x,y) and the low bits of the
│ │ │ │ + gmpy2.remquo(xx, yy, //) → tuple[_m_p_f_r, int]_
│ │ │ │ + Return a tuple containing the remainder(x,y) and the low bits of the
│ │ │ │ quotient.
│ │ │ │ gmpy2.rint(xx, //) → _m_p_f_r_
│ │ │ │ Return x rounded to the nearest integer using the current rounding mode.
│ │ │ │ gmpy2.rint_ceil(xx, //) → _m_p_f_r_
│ │ │ │ Return x rounded to the nearest integer by first rounding to the next
│ │ │ │ higher or equal integer and then, if needed, using the current rounding
│ │ │ │ mode.
│ │ │ │ @@ -409,19 +409,19 @@
│ │ │ │ Return hyperbolic secant of x.
│ │ │ │ gmpy2.set_exp(xx, nn, //) → _m_p_f_r_
│ │ │ │ Set the exponent of x to n. If n is outside the range of valid exponents,
│ │ │ │ _s_e_t___e_x_p_(_) will set the _c_o_n_t_e_x_t_._e_r_a_n_g_e flag of the current context and
│ │ │ │ either return the original value or raise an exception if
│ │ │ │ _c_o_n_t_e_x_t_._t_r_a_p___e_r_a_n_g_e is set.
│ │ │ │ gmpy2.set_sign(xx, ss, //) → _m_p_f_r_
│ │ │ │ - If s is _T_r_u_e, then return x with the sign bit set.
│ │ │ │ - gmpy2.sign(xx, //) → _i_n_t_
│ │ │ │ + If s is True, then return x with the sign bit set.
│ │ │ │ + gmpy2.sign(xx, //) → int_
│ │ │ │ Return -1 if x < 0, 0 if x == 0, or +1 if x >0.
│ │ │ │ - gmpy2.sinh_cosh(xx, //) → _t_u_p_l_e[_m_p_f_r, _m_p_f_r]_
│ │ │ │ - Return a _t_u_p_l_e containing the hyperbolic sine and cosine of x.
│ │ │ │ + gmpy2.sinh_cosh(xx, //) → tuple[_m_p_f_r, _m_p_f_r]_
│ │ │ │ + Return a tuple containing the hyperbolic sine and cosine of x.
│ │ │ │ gmpy2.trunc(xx, //) → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r that is x truncated towards 0. Same as x.floor() if x>=0
│ │ │ │ or x.ceil() if x<0.
│ │ │ │ gmpy2.y0(xx, //) → _m_p_f_r_
│ │ │ │ Return second kind Bessel function of order 0 of x.
│ │ │ │ gmpy2.y1(xx, //) → _m_p_f_r_
│ │ │ │ Return second kind Bessel function of order 1 of x.
│ │ │ │ @@ -429,28 +429,28 @@
│ │ │ │ Return the second kind Bessel function of order n of x. Note: the order
│ │ │ │ of the arguments changed in gmpy2 2.2.0a2
│ │ │ │ gmpy2.zero(nn, //) → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r initialized to 0.0 with the same sign as n. If n is not
│ │ │ │ given, +0.0 is returned.
│ │ │ │ gmpy2.zeta(xx, //) → _m_p_f_r_
│ │ │ │ Return Riemann zeta of x.
│ │ │ │ - gmpy2.get_max_precision() → _i_n_t_
│ │ │ │ + gmpy2.get_max_precision() → int_
│ │ │ │ Return the maximum bits of precision that can be used for calculations.
│ │ │ │ Note: to allow extra precision for intermediate calculations, avoid
│ │ │ │ setting precision close the maximum precision.
│ │ │ │ - gmpy2.get_emax_max() → _i_n_t_
│ │ │ │ + gmpy2.get_emax_max() → int_
│ │ │ │ Return the maximum possible exponent that can be set for _m_p_f_r.
│ │ │ │ - gmpy2.get_emin_min() → _i_n_t_
│ │ │ │ + gmpy2.get_emin_min() → int_
│ │ │ │ Return the minimum possible exponent that can be set for _m_p_f_r.
│ │ │ │ gmpy2.copy_sign(xx, yy, //) → _m_p_f_r_
│ │ │ │ Return an _m_p_f_r composed of x with the sign of y.
│ │ │ │ - gmpy2.can_round(bb, eerrrr, rrnndd11, rrnndd22, pprreecc, //) → _b_o_o_l_
│ │ │ │ + gmpy2.can_round(bb, eerrrr, rrnndd11, rrnndd22, pprreecc, //) → bool_
│ │ │ │ Let b be an approximation to an unknown number x that is rounded
│ │ │ │ according to rnd1. Assume the b has an error at most two to the power of
│ │ │ │ - E(b)-err where E(b) is the exponent of b. Then return _T_r_u_e if x can be
│ │ │ │ + E(b)-err where E(b) is the exponent of b. Then return True if x can be
│ │ │ │ rounded correctly to prec bits with rounding mode rnd2.
│ │ │ │ - gmpy2.free_cache() → _N_o_n_e_
│ │ │ │ + gmpy2.free_cache() → None_
│ │ │ │ Free the internal cache of constants maintained by MPFR.
│ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t
│ │ │ │ ===============================================================================
│ │ │ │ © Copyright 2024 - 2024, Case Van Horsen.
│ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by _R_e_a_d_ _t_h_e_ _D_o_c_s.
│ │ ├── ./usr/share/doc/python-gmpy2-doc/html/mpq.html
│ │ │ @@ -115,51 +115,51 @@
│ │ │
│ │ │ class gmpy2.mpq(n=0, /)
│ │ │
│ │ │ class gmpy2.mpq(n, m, /)
│ │ │
│ │ │ class gmpy2.mpq(s, /, base=10)
│ │ │
Return a rational number constructed from a non-complex number n
│ │ │ -exactly or from a pair of Rational
values n and m or
│ │ │ +exactly or from a pair of Rational
values n and m or
│ │ │ from a string s made up of digits in the given base.
│ │ │ -Every input, that is accepted by the Fraction
type
│ │ │ +Every input, that is accepted by the Fraction
type
│ │ │ constructor is also accepted.
│ │ │ A string may be made up to two integers in the same base separated
│ │ │ by a '/' character, both parsed the same as the mpz
type constructor
│ │ │ does. If base is 0 then the leading characters are used to recognize the
│ │ │ base, this is done separately for the numerator and denominator. If
│ │ │ base=10, any string that represents a finite value and is accepted by
│ │ │ -the float
constructor is also accepted.
│ │ │ +the float
constructor is also accepted.
│ │ │
│ │ │ -
│ │ │ -as_integer_ratio() → tuple[mpz, mpz]
│ │ │ +as_integer_ratio() → tuple[mpz, mpz]
│ │ │ Return a pair of integers, whose ratio is exactly equal to the
│ │ │ original number. The ratio is in lowest terms and has a
│ │ │ positive denominator.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ conjugate() → mpz
│ │ │ Return the conjugate of x (which is just a new reference to x since x is
│ │ │ not a complex number).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -digits(base=10, /) → str
│ │ │ +digits(base=10, /) → str
│ │ │ Return a Python string representing x in the given base (2 to 62,
│ │ │ default is 10). A leading '-' is present if x<0, but no leading '+'
│ │ │ is present if x>=0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ from_decimal(dec, /) → mpq
│ │ │ -Converts a finite decimal.Decimal
instance to a rational number, exactly.
│ │ │ +Converts a finite decimal.Decimal
instance to a rational number, exactly.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ from_float(f, /) → mpq
│ │ │ Converts a finite float to a rational number, exactly.
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -35,36 +35,36 @@
│ │ │ │ ===============================================================================
│ │ │ │ ************ RRaattiioonnaallss_? ************
│ │ │ │ ********** mmppqq ttyyppee_? **********
│ │ │ │ ccllaassss gmpy2.mpq(nn==00, //)_
│ │ │ │ ccllaassss gmpy2.mpq(nn, mm, //)
│ │ │ │ ccllaassss gmpy2.mpq(ss, //, bbaassee==1100)
│ │ │ │ Return a rational number constructed from a non-complex number n exactly
│ │ │ │ - or from a pair of _R_a_t_i_o_n_a_l values n and m or from a string s made up of
│ │ │ │ - digits in the given base. Every input, that is accepted by the _F_r_a_c_t_i_o_n
│ │ │ │ + or from a pair of Rational values n and m or from a string s made up of
│ │ │ │ + digits in the given base. Every input, that is accepted by the Fraction
│ │ │ │ type constructor is also accepted.
│ │ │ │ A string may be made up to two integers in the same base separated by a
│ │ │ │ '/' character, both parsed the same as the _m_p_z type constructor does. If
│ │ │ │ base is 0 then the leading characters are used to recognize the base,
│ │ │ │ this is done separately for the numerator and denominator. If base=10,
│ │ │ │ - any string that represents a finite value and is accepted by the _f_l_o_a_t
│ │ │ │ + any string that represents a finite value and is accepted by the float
│ │ │ │ constructor is also accepted.
│ │ │ │ - as_integer_ratio() → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + as_integer_ratio() → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a pair of integers, whose ratio is exactly equal to the
│ │ │ │ original number. The ratio is in lowest terms and has a positive
│ │ │ │ denominator.
│ │ │ │ conjugate() → _m_p_z_
│ │ │ │ Return the conjugate of x (which is just a new reference to x since
│ │ │ │ x is not a complex number).
│ │ │ │ - digits(bbaassee==1100, //) → _s_t_r_
│ │ │ │ + digits(bbaassee==1100, //) → str_
│ │ │ │ Return a Python string representing x in the given base (2 to 62,
│ │ │ │ default is 10). A leading '-' is present if x<0, but no leading '+'
│ │ │ │ is present if x>=0.
│ │ │ │ from_decimal(ddeecc, //) → _m_p_q_
│ │ │ │ - Converts a finite _d_e_c_i_m_a_l_._D_e_c_i_m_a_l instance to a rational number,
│ │ │ │ + Converts a finite decimal.Decimal instance to a rational number,
│ │ │ │ exactly.
│ │ │ │ from_float(ff, //) → _m_p_q_
│ │ │ │ Converts a finite float to a rational number, exactly.
│ │ │ │ denominator_
│ │ │ │ the denominator of a rational number in lowest terms
│ │ │ │ imag_
│ │ │ │ the imaginary part of a complex number
│ │ ├── ./usr/share/doc/python-gmpy2-doc/html/mpz.html
│ │ │ @@ -204,25 +204,25 @@
│ │ │
│ │ │ -
│ │ │ class gmpy2.mpz(n=0, /)
│ │ │ -
│ │ │ class gmpy2.mpz(s, /, base=0)
│ │ │ Return an immutable integer constructed from a numeric value n (truncating
│ │ │ n to its integer part) or a string s made of digits in the given base.
│ │ │ -Every input, that is accepted by the int
type constructor is also accepted.
│ │ │ +Every input, that is accepted by the int
type constructor is also accepted.
│ │ │ The base may vary from 2 to 62, or if base is 0, then binary, octal, or
│ │ │ hexadecimal strings are recognized by leading '0b', '0o', or '0x'
│ │ │ characters (case is ignored), otherwise the string is assumed to be
│ │ │ decimal. For bases up to 36, digits case is ignored. For bases 37
│ │ │ to 62, upper-case letter represent the usual 10..35 range, while
│ │ │ lower-case letter represent 36..61. Optionally the string can be
│ │ │ preceded by '+' or '-'. White space and underscore is simply ignored.
│ │ │
│ │ │ -
│ │ │ -__format__(fmt) → str
│ │ │ +__format__(fmt) → str
│ │ │ Return a Python string by formatting mpz
'x' using the format string
│ │ │ 'fmt'. A valid format string consists of:
│ │ │
│ │ │ optional alignment code:
│ │ │
│ │ │ '<' -> left shifted in field
│ │ │ '>' -> right shifted in field
│ │ │ @@ -249,193 +249,193 @@
│ │ │
│ │ │
│ │ │ The default format is 'd'.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -as_integer_ratio() → tuple[mpz, mpz]
│ │ │ +as_integer_ratio() → tuple[mpz, mpz]
│ │ │ Return a pair of integers, whose ratio is exactly equal to the
│ │ │ original number. The ratio is in lowest terms and has a
│ │ │ positive denominator.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ bit_clear(n, /) → mpz
│ │ │ Return a copy of x with the n-th bit cleared.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -bit_count() → int
│ │ │ +bit_count() → int
│ │ │ Return the number of 1-bits set in abs(x).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ bit_flip(n, /) → mpz
│ │ │ Return a copy of x with the n-th bit inverted.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -bit_length() → int
│ │ │ +bit_length() → int
│ │ │ Return the number of significant bits in the radix-2
│ │ │ representation of x. Note: mpz(0).bit_length() returns 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -bit_scan0(n=0, /) → int | None
│ │ │ +bit_scan0(n=0, /) → int | None
│ │ │ Return the index of the first 0-bit of x with index >= n. n >= 0.
│ │ │ If there are no more 0-bits in x at or above index n (which can
│ │ │ only happen for x<0, assuming an infinitely long 2's complement
│ │ │ -format), then None
is returned.
│ │ │ +format), then None
is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -bit_scan1(n=0, /) → int | None
│ │ │ +bit_scan1(n=0, /) → int | None
│ │ │ Return the index of the first 1-bit of x with index >= n. n >= 0.
│ │ │ If there are no more 1-bits in x at or above index n (which can
│ │ │ only happen for x>=0, assuming an infinitely long 2's complement
│ │ │ -format), then None
is returned.
│ │ │ +format), then None
is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ bit_set(n, /) → mpz
│ │ │ Return a copy of x with the n-th bit set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -bit_test(n, /) → bool
│ │ │ +bit_test(n, /) → bool
│ │ │ Return the value of the n-th bit of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ conjugate() → mpz
│ │ │ Return the conjugate of x (which is just a new reference to x since x is
│ │ │ not a complex number).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -digits(base=10, /) → str
│ │ │ +digits(base=10, /) → str
│ │ │ Return Python string representing x in the given base. Values for
│ │ │ base can range between 2 to 62. A leading '-' is present if x<0
│ │ │ but no leading '+' is present if x>=0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ from_bytes(bytes, byteorder='big', *, signed=False) → mpz
│ │ │ Return the integer represented by the given array of bytes.
│ │ │
│ │ │
│ │ │ - bytes
Holds the array of bytes to convert. The argument must either
│ │ │ support the buffer protocol or be an iterable object producing bytes.
│ │ │ -bytes
and bytearray
are examples of built-in objects that support
│ │ │ +bytes
and bytearray
are examples of built-in objects that support
│ │ │ the buffer protocol.
│ │ │
│ │ │ - byteorder
The byte order used to represent the integer. If byteorder is 'big',
│ │ │ the most significant byte is at the beginning of the byte array. If
│ │ │ byteorder is 'little', the most significant byte is at the end of the
│ │ │ byte array. To request the native byte order of the host system, use
│ │ │ -sys.byteorder
as the byte order value.
│ │ │ +sys.byteorder
as the byte order value.
│ │ │
│ │ │ - signed
Indicates whether two's complement is used to represent the integer.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_congruent(y, m, /) → bool
│ │ │ -Returns True
if x is congruent to y modulo m, else return False
.
│ │ │ +is_congruent(y, m, /) → bool
│ │ │ +Returns True
if x is congruent to y modulo m, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_divisible(d, /) → bool
│ │ │ -Returns True
if x is divisible by d, else return False
.
│ │ │ +is_divisible(d, /) → bool
│ │ │ +Returns True
if x is divisible by d, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_even() → bool
│ │ │ -Return True
if x is even, False
otherwise.
│ │ │ +is_even() → bool
│ │ │ +Return True
if x is even, False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_odd() → bool
│ │ │ -Return True
if x is odd, False
otherwise.
│ │ │ +is_odd() → bool
│ │ │ +Return True
if x is odd, False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_power() → bool
│ │ │ -Return True
if x is a perfect power (there exists a y and an
│ │ │ -n > 1, such that x=y**n), else return False
.
│ │ │ +is_power() → bool
│ │ │ +Return True
if x is a perfect power (there exists a y and an
│ │ │ +n > 1, such that x=y**n), else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_prime(n=25, /) → bool
│ │ │ -Return True
if x is probably prime, else False
if x is
│ │ │ +is_prime(n=25, /) → bool
│ │ │ +
Return True
if x is probably prime, else False
if x is
│ │ │ definitely composite. x is checked for small divisors and up
│ │ │ to n Miller-Rabin tests are performed.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_probab_prime(n=25, /) → int
│ │ │ +is_probab_prime(n=25, /) → int
│ │ │ Return 2 if x is definitely prime, 1 if x is probably prime,
│ │ │ or return 0 if x is definitely non-prime. x is checked for small
│ │ │ divisors and up to n Miller-Rabin tests are performed. Reasonable
│ │ │ values of n are between 15 and 50.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -is_square() → bool
│ │ │ -Returns True
if x is a perfect square, else return False
.
│ │ │ +is_square() → bool
│ │ │ +Returns True
if x is a perfect square, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -num_digits(base=10, /) → int
│ │ │ +num_digits(base=10, /) → int
│ │ │ Return length of string representing the absolute value of x in
│ │ │ the given base. Values for base can range between 2 and 62. The
│ │ │ value returned may be 1 too large.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -to_bytes(length=1, byteorder='big', *, signed=False) → bytes
│ │ │ +to_bytes(length=1, byteorder='big', *, signed=False) → bytes
│ │ │ Return an array of bytes representing an integer.
│ │ │
│ │ │
│ │ │ -- length
Length of bytes object to use. An OverflowError
is raised if the
│ │ │ +
- length
Length of bytes object to use. An OverflowError
is raised if the
│ │ │ integer is not representable with the given number of bytes.
│ │ │
│ │ │ - byteorder
The byte order used to represent the integer. If byteorder is
│ │ │ 'big', the most significant byte is at the beginning of the byte
│ │ │ array. If byteorder is 'little', the most significant byte is at
│ │ │ the end of the byte array. To request the native byte order of the
│ │ │ -host system, use sys.byteorder
as the byte order value.
│ │ │ +host system, use sys.byteorder
as the byte order value.
│ │ │
│ │ │ - signed
Determines whether two's complement is used to represent the
│ │ │ -integer. If signed is False
and a negative integer is given,
│ │ │ -an OverflowError
is raised.
│ │ │ +integer. If signed is False
and a negative integer is given,
│ │ │ +an OverflowError
is raised.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -476,64 +476,64 @@
│ │ │
-
│ │ │ gmpy2.bit_clear(x, n, /) → mpz
│ │ │ Return a copy of x with the n-th bit cleared.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.bit_count(x, /) → int
│ │ │ +gmpy2.bit_count(x, /) → int
│ │ │ Return the number of 1-bits set in abs(x).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.bit_flip(x, n, /) → mpz
│ │ │ Return a copy of x with the n-th bit inverted.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.bit_length(x, /) → int
│ │ │ +gmpy2.bit_length(x, /) → int
│ │ │ Return the number of significant bits in the radix-2
│ │ │ representation of x. Note: bit_length(0) returns 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.bit_mask(n, /) → mpz
│ │ │ Return an mpz
exactly n bits in length with all bits set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.bit_scan0(x, n=0, /) → int | None
│ │ │ +gmpy2.bit_scan0(x, n=0, /) → int | None
│ │ │ Return the index of the first 0-bit of x with index >= n. n >= 0.
│ │ │ If there are no more 0-bits in x at or above index n (which can
│ │ │ only happen for x<0, assuming an infinitely long 2's complement
│ │ │ -format), then None
is returned.
│ │ │ +format), then None
is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.bit_scan1(x, n=0, /) → int | None
│ │ │ +gmpy2.bit_scan1(x, n=0, /) → int | None
│ │ │ Return the index of the first 1-bit of x with index >= n. n >= 0.
│ │ │ If there are no more 1-bits in x at or above index n (which can
│ │ │ only happen for x>=0, assuming an infinitely long 2's complement
│ │ │ -format), then None
is returned.
│ │ │ +format), then None
is returned.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.bit_set(x, n, /) → mpz
│ │ │ Return a copy of x with the n-th bit set.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.bit_test(x, n, /) → bool
│ │ │ +gmpy2.bit_test(x, n, /) → bool
│ │ │ Return the value of the n-th bit of x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.c_div(x, y, /) → mpz
│ │ │ Return the quotient of x divided by y. The quotient is rounded
│ │ │ @@ -545,23 +545,23 @@
│ │ │ gmpy2.c_div_2exp(x, n, /) → mpz
│ │ │
Returns the quotient of x divided by 2**n. The quotient is rounded
│ │ │ towards +Inf (ceiling rounding). x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.c_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.c_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ Return the quotient and remainder of x divided by y. The quotient
│ │ │ is rounded towards +Inf (ceiling rounding) and the remainder will
│ │ │ have the opposite sign of y. x and y must be integers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.c_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.c_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ Return the quotient and remainder of x divided by 2**n. The quotient
│ │ │ is rounded towards +Inf (ceiling rounding) and the remainder will
│ │ │ be negative. x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -590,15 +590,15 @@
│ │ │
Return the quotient of x divided by y. Faster than standard
│ │ │ division but requires the remainder is zero!
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.divm(a, b, m, /) → mpz
│ │ │ -Return x such that b*x == a mod m. Raises a ZeroDivisionError
│ │ │ +
Return x such that b*x == a mod m. Raises a ZeroDivisionError
│ │ │ exception if no such value x exists.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.double_fac(n, /) → mpz
│ │ │ Return the exact double factorial (n!!) of n. The double
│ │ │ @@ -617,23 +617,23 @@
│ │ │ gmpy2.f_div_2exp(x, n, /) → mpz
│ │ │
Return the quotient of x divided by 2**n. The quotient is rounded
│ │ │ towards -Inf (floor rounding). x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.f_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.f_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ Return the quotient and remainder of x divided by y. The quotient
│ │ │ is rounded towards -Inf (floor rounding) and the remainder will
│ │ │ have the same sign as y. x and y must be integers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.f_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.f_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ Return quotient and remainder after dividing x by 2**n. The quotient
│ │ │ is rounded towards -Inf (floor rounding) and the remainder will be
│ │ │ positive. x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -660,111 +660,111 @@
│ │ │
-
│ │ │ gmpy2.fib(n, /) → mpz
│ │ │ Return the n-th Fibonacci number.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.fib2(n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.fib2(n, /) → tuple[mpz, mpz]
│ │ │ Return a 2-tuple with the (n-1)-th and n-th Fibonacci numbers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.gcd(*integers, /) → mpz
│ │ │ Return the greatest common divisor of integers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.gcdext(a, b, /) → tuple[mpz, mpz, mpz]
│ │ │ +gmpy2.gcdext(a, b, /) → tuple[mpz, mpz, mpz]
│ │ │ Return a 3-element tuple (g,s,t) such that g == gcd(a,b)
│ │ │ and g == a*s + b*t.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.hamdist(x, y, /) → int
│ │ │ +gmpy2.hamdist(x, y, /) → int
│ │ │ Return the Hamming distance (number of bit-positions where the
│ │ │ bits differ) between integers x and y.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.invert(x, m, /) → mpz
│ │ │ -Return y such that x*y == 1 modulo m. Raises ZeroDivisionError
if no
│ │ │ +
Return y such that x*y == 1 modulo m. Raises ZeroDivisionError
if no
│ │ │ inverse exists.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.iroot(x, n, /) → tuple[mpz, bool]
│ │ │ -Return the integer n-th root of x and boolean value that is True
│ │ │ +gmpy2.iroot(x, n, /) → tuple[mpz, bool]
│ │ │ +
Return the integer n-th root of x and boolean value that is True
│ │ │ iff the root is exact. x >= 0. n > 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.iroot_rem(x, n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.iroot_rem(x, n, /) → tuple[mpz, mpz]
│ │ │ Return a 2-element tuple (y,r), such that y is the integer n-th
│ │ │ root of x and x=y**n + r. x >= 0. n > 0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_congruent(x, y, m, /) → bool
│ │ │ -Returns True
if x is congruent to y modulo m, else return False
.
│ │ │ +gmpy2.is_congruent(x, y, m, /) → bool
│ │ │ +Returns True
if x is congruent to y modulo m, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_divisible(x, d, /) → bool
│ │ │ -Returns True
if x is divisible by d, else return False
.
│ │ │ +gmpy2.is_divisible(x, d, /) → bool
│ │ │ +Returns True
if x is divisible by d, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_even(x, /) → bool
│ │ │ -Return True
if x is even, False
otherwise.
│ │ │ +gmpy2.is_even(x, /) → bool
│ │ │ +Return True
if x is even, False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_odd(x, /) → bool
│ │ │ -Return True
if x is odd, False
otherwise.
│ │ │ +gmpy2.is_odd(x, /) → bool
│ │ │ +Return True
if x is odd, False
otherwise.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_power(x, /) → bool
│ │ │ -Return True
if x is a perfect power (there exists a y and an
│ │ │ -n > 1, such that x=y**n), else return False
.
│ │ │ +gmpy2.is_power(x, /) → bool
│ │ │ +Return True
if x is a perfect power (there exists a y and an
│ │ │ +n > 1, such that x=y**n), else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_prime(x, n=25, /) → bool
│ │ │ -Return True
if x is probably prime, else False
if x is
│ │ │ +gmpy2.is_prime(x, n=25, /) → bool
│ │ │ +
Return True
if x is probably prime, else False
if x is
│ │ │ definitely composite. x is checked for small divisors and up
│ │ │ to n Miller-Rabin tests are performed.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_probab_prime(x, n=25, /) → int
│ │ │ +gmpy2.is_probab_prime(x, n=25, /) → int
│ │ │ Return 2 if x is definitely prime, 1 if x is probably prime,
│ │ │ or return 0 if x is definitely non-prime. x is checked for small
│ │ │ divisors and up to n Miller-Rabin tests are performed. Reasonable
│ │ │ values of n are between 15 and 50.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.is_square(x, /) → bool
│ │ │ -Returns True
if x is a perfect square, else return False
.
│ │ │ +gmpy2.is_square(x, /) → bool
│ │ │ +Returns True
if x is a perfect square, else return False
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.isqrt(x, /) → mpz
│ │ │ Return the integer square root of a non-negative integer x.
│ │ │
│ │ │ @@ -804,15 +804,15 @@
│ │ │ -
│ │ │ gmpy2.lucas(n, /) → mpz
│ │ │ Return the n-th Lucas number.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.lucas2(n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.lucas2(n, /) → tuple[mpz, mpz]
│ │ │ Return a 2-tuple with the (n-1)-th and n-th Lucas numbers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.mpz_random(random_state, int, /) → mpz
│ │ │ Return uniformly distributed random integer between 0 and n-1.
│ │ │ @@ -842,15 +842,15 @@
│ │ │ -
│ │ │ gmpy2.next_prime(x, /) → mpz
│ │ │ Return the next probable prime number > x.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.num_digits(x, base=10, /) → int
│ │ │ +gmpy2.num_digits(x, base=10, /) → int
│ │ │ Return length of string representing the absolute value of x in
│ │ │ the given base. Values for base can range between 2 and 62. The
│ │ │ value returned may be 1 too large.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -859,36 +859,36 @@
│ │ │ each integer element of lst after padding to length n bits. Raises
│ │ │ an error if any integer is negative or greater than n bits in
│ │ │ length.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.popcount(x, /) → int
│ │ │ +gmpy2.popcount(x, /) → int
│ │ │ Return the number of 1-bits set in x. If x<0, the number of
│ │ │ 1-bits is infinite so -1 is returned in that case.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.powmod(x, y, m, /) → mpz
│ │ │ Return (x**y) mod m. Same as the three argument version of Python's
│ │ │ -built-in pow
, but converts all three arguments to mpz
.
│ │ │ +built-in pow
, but converts all three arguments to mpz
.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.powmod_exp_list(base, exp_lst, mod, /) → list[mpz, ...]
│ │ │ +gmpy2.powmod_exp_list(base, exp_lst, mod, /) → list[mpz, ...]
│ │ │ Returns list(powmod(base, i, mod) for i in exp_lst). Will always release
│ │ │ the GIL. (Experimental in gmpy2 2.1.x).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.powmod_base_list(base_lst, exp, mod, /) → list[mpz, ...]
│ │ │ +gmpy2.powmod_base_list(base_lst, exp, mod, /) → list[mpz, ...]
│ │ │ Returns list(powmod(i, exp, mod) for i in base_lst). Will always release
│ │ │ the GIL. (Experimental in gmpy2 2.1.x).
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ gmpy2.powmod_sec(x, y, m, /) → mpz
│ │ │ @@ -909,15 +909,15 @@
│ │ │ gmpy2.primorial(n, /) → mpz
│ │ │ Return the product of all positive prime numbers less than or
│ │ │ equal to n.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.remove(x, f, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.remove(x, f, /) → tuple[mpz, mpz]
│ │ │ Return a 2-element tuple (y,m) such that x=y*(f**m) and f does
│ │ │ not divide y. Remove the factor f from x as many times as
│ │ │ possible. m is the multiplicity f in x. f > 1.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -931,23 +931,23 @@
│ │ │ gmpy2.t_div_2exp(x, n, /) → mpz
│ │ │ Return the quotient of x divided by 2**n. The quotient is rounded
│ │ │ towards zero (truncation). n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.t_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.t_divmod(x, y, /) → tuple[mpz, mpz]
│ │ │ Return the quotient and remainder of x divided by y. The quotient
│ │ │ is rounded towards zero (truncation) and the remainder will have
│ │ │ the same sign as x. x and y must be integers.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.t_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ +gmpy2.t_divmod_2exp(x, n, /) → tuple[mpz, mpz]
│ │ │ Return the quotient and remainder of x divided by 2**n. The quotient
│ │ │ is rounded towards zero (truncation) and the remainder will have the
│ │ │ same sign as x. x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ @@ -961,15 +961,15 @@
│ │ │ gmpy2.t_mod_2exp(x, n, /) → mpz
│ │ │ Return the remainder of x divided by 2**n. The remainder will have
│ │ │ the same sign as x. x must be an integer. n must be >0.
│ │ │
│ │ │
│ │ │
│ │ │ -
│ │ │ -gmpy2.unpack(x, n, /) → list
│ │ │ +gmpy2.unpack(x, n, /) → list
│ │ │ Unpack an integer x into a list of n-bit values. Equivalent to
│ │ │ repeated division by 2**n. Raises error if x is negative.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -125,24 +125,24 @@
│ │ │ │ ===============================================================================
│ │ │ │ ************ IInntteeggeerrss_? ************
│ │ │ │ ********** mmppzz ttyyppee_? **********
│ │ │ │ ccllaassss gmpy2.mpz(nn==00, //)_
│ │ │ │ ccllaassss gmpy2.mpz(ss, //, bbaassee==00)
│ │ │ │ Return an immutable integer constructed from a numeric value n
│ │ │ │ (truncating n to its integer part) or a string s made of digits in the
│ │ │ │ - given base. Every input, that is accepted by the _i_n_t type constructor is
│ │ │ │ + given base. Every input, that is accepted by the int type constructor is
│ │ │ │ also accepted.
│ │ │ │ The base may vary from 2 to 62, or if base is 0, then binary, octal, or
│ │ │ │ hexadecimal strings are recognized by leading '0b', '0o', or '0x'
│ │ │ │ characters (case is ignored), otherwise the string is assumed to be
│ │ │ │ decimal. For bases up to 36, digits case is ignored. For bases 37 to 62,
│ │ │ │ upper-case letter represent the usual 10..35 range, while lower-case
│ │ │ │ letter represent 36..61. Optionally the string can be preceded by '+' or
│ │ │ │ '-'. White space and underscore is simply ignored.
│ │ │ │ - __format__(ffmmtt) → _s_t_r_
│ │ │ │ + __format__(ffmmtt) → str_
│ │ │ │ Return a Python string by formatting _m_p_z 'x' using the format
│ │ │ │ string 'fmt'. A valid format string consists of:
│ │ │ │ optional alignment code:
│ │ │ │ '<' -> left shifted in field '>' -> right
│ │ │ │ shifted in field '^' -> centered in field
│ │ │ │ optional leading sign code:
│ │ │ │ '+' -> always display leading sign '-' -> only
│ │ │ │ @@ -153,159 +153,159 @@
│ │ │ │ 0o or 0x
│ │ │ │ optional width
│ │ │ │ optional conversion code:
│ │ │ │ 'd' -> decimal format 'b' -> binary format 'o'
│ │ │ │ -> octal format 'x' -> hex format 'X' -> upper-
│ │ │ │ case hex format
│ │ │ │ The default format is 'd'.
│ │ │ │ - as_integer_ratio() → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + as_integer_ratio() → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a pair of integers, whose ratio is exactly equal to the
│ │ │ │ original number. The ratio is in lowest terms and has a positive
│ │ │ │ denominator.
│ │ │ │ bit_clear(nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit cleared.
│ │ │ │ - bit_count() → _i_n_t_
│ │ │ │ + bit_count() → int_
│ │ │ │ Return the number of 1-bits set in abs(x).
│ │ │ │ bit_flip(nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit inverted.
│ │ │ │ - bit_length() → _i_n_t_
│ │ │ │ + bit_length() → int_
│ │ │ │ Return the number of significant bits in the radix-2 representation
│ │ │ │ of x. Note: mpz(0).bit_length() returns 0.
│ │ │ │ - bit_scan0(nn==00, //) → _i_n_t | _N_o_n_e_
│ │ │ │ + bit_scan0(nn==00, //) → int | None_
│ │ │ │ Return the index of the first 0-bit of x with index >= n. n >= 0.
│ │ │ │ If there are no more 0-bits in x at or above index n (which can
│ │ │ │ only happen for x<0, assuming an infinitely long 2's complement
│ │ │ │ - format), then _N_o_n_e is returned.
│ │ │ │ - bit_scan1(nn==00, //) → _i_n_t | _N_o_n_e_
│ │ │ │ + format), then None is returned.
│ │ │ │ + bit_scan1(nn==00, //) → int | None_
│ │ │ │ Return the index of the first 1-bit of x with index >= n. n >= 0.
│ │ │ │ If there are no more 1-bits in x at or above index n (which can
│ │ │ │ only happen for x>=0, assuming an infinitely long 2's complement
│ │ │ │ - format), then _N_o_n_e is returned.
│ │ │ │ + format), then None is returned.
│ │ │ │ bit_set(nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit set.
│ │ │ │ - bit_test(nn, //) → _b_o_o_l_
│ │ │ │ + bit_test(nn, //) → bool_
│ │ │ │ Return the value of the n-th bit of x.
│ │ │ │ conjugate() → _m_p_z_
│ │ │ │ Return the conjugate of x (which is just a new reference to x since
│ │ │ │ x is not a complex number).
│ │ │ │ - digits(bbaassee==1100, //) → _s_t_r_
│ │ │ │ + digits(bbaassee==1100, //) → str_
│ │ │ │ Return Python string representing x in the given base. Values for
│ │ │ │ base can range between 2 to 62. A leading '-' is present if x<0 but
│ │ │ │ no leading '+' is present if x>=0.
│ │ │ │ from_bytes(bbyytteess, bbyytteeoorrddeerr==''bbiigg'', **, ssiiggnneedd==FFaallssee) → _m_p_z_
│ │ │ │ Return the integer represented by the given array of bytes.
│ │ │ │ bytes
│ │ │ │ Holds the array of bytes to convert. The argument
│ │ │ │ must either support the buffer protocol or be an
│ │ │ │ - iterable object producing bytes. _b_y_t_e_s and
│ │ │ │ - _b_y_t_e_a_r_r_a_y are examples of built-in objects that
│ │ │ │ + iterable object producing bytes. bytes and
│ │ │ │ + bytearray are examples of built-in objects that
│ │ │ │ support the buffer protocol.
│ │ │ │ byteorder
│ │ │ │ The byte order used to represent the integer. If
│ │ │ │ byteorder is 'big', the most significant byte is at
│ │ │ │ the beginning of the byte array. If byteorder is
│ │ │ │ 'little', the most significant byte is at the end
│ │ │ │ of the byte array. To request the native byte order
│ │ │ │ - of the host system, use _s_y_s_._b_y_t_e_o_r_d_e_r as the byte
│ │ │ │ + of the host system, use sys.byteorder as the byte
│ │ │ │ order value.
│ │ │ │ signed
│ │ │ │ Indicates whether two's complement is used to
│ │ │ │ represent the integer.
│ │ │ │ - is_congruent(yy, mm, //) → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is congruent to y modulo m, else return _F_a_l_s_e.
│ │ │ │ - is_divisible(dd, //) → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is divisible by d, else return _F_a_l_s_e.
│ │ │ │ - is_even() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is even, _F_a_l_s_e otherwise.
│ │ │ │ - is_odd() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is odd, _F_a_l_s_e otherwise.
│ │ │ │ - is_power() → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is a perfect power (there exists a y and an n > 1,
│ │ │ │ - such that x=y**n), else return _F_a_l_s_e.
│ │ │ │ - is_prime(nn==2255, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is pprroobbaabbllyy prime, else _F_a_l_s_e if x is definitely
│ │ │ │ + is_congruent(yy, mm, //) → bool_
│ │ │ │ + Returns True if x is congruent to y modulo m, else return False.
│ │ │ │ + is_divisible(dd, //) → bool_
│ │ │ │ + Returns True if x is divisible by d, else return False.
│ │ │ │ + is_even() → bool_
│ │ │ │ + Return True if x is even, False otherwise.
│ │ │ │ + is_odd() → bool_
│ │ │ │ + Return True if x is odd, False otherwise.
│ │ │ │ + is_power() → bool_
│ │ │ │ + Return True if x is a perfect power (there exists a y and an n > 1,
│ │ │ │ + such that x=y**n), else return False.
│ │ │ │ + is_prime(nn==2255, //) → bool_
│ │ │ │ + Return True if x is pprroobbaabbllyy prime, else False if x is definitely
│ │ │ │ composite. x is checked for small divisors and up to n Miller-Rabin
│ │ │ │ tests are performed.
│ │ │ │ - is_probab_prime(nn==2255, //) → _i_n_t_
│ │ │ │ + is_probab_prime(nn==2255, //) → int_
│ │ │ │ Return 2 if x is definitely prime, 1 if x is probably prime, or
│ │ │ │ return 0 if x is definitely non-prime. x is checked for small
│ │ │ │ divisors and up to n Miller-Rabin tests are performed. Reasonable
│ │ │ │ values of n are between 15 and 50.
│ │ │ │ - is_square() → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is a perfect square, else return _F_a_l_s_e.
│ │ │ │ - num_digits(bbaassee==1100, //) → _i_n_t_
│ │ │ │ + is_square() → bool_
│ │ │ │ + Returns True if x is a perfect square, else return False.
│ │ │ │ + num_digits(bbaassee==1100, //) → int_
│ │ │ │ Return length of string representing the absolute value of x in the
│ │ │ │ given base. Values for base can range between 2 and 62. The value
│ │ │ │ returned may be 1 too large.
│ │ │ │ - to_bytes(lleennggtthh==11, bbyytteeoorrddeerr==''bbiigg'', **, ssiiggnneedd==FFaallssee) → _b_y_t_e_s_
│ │ │ │ + to_bytes(lleennggtthh==11, bbyytteeoorrddeerr==''bbiigg'', **, ssiiggnneedd==FFaallssee) → bytes_
│ │ │ │ Return an array of bytes representing an integer.
│ │ │ │ length
│ │ │ │ - Length of bytes object to use. An _O_v_e_r_f_l_o_w_E_r_r_o_r is
│ │ │ │ + Length of bytes object to use. An OverflowError is
│ │ │ │ raised if the integer is not representable with the
│ │ │ │ given number of bytes.
│ │ │ │ byteorder
│ │ │ │ The byte order used to represent the integer. If
│ │ │ │ byteorder is 'big', the most significant byte is at
│ │ │ │ the beginning of the byte array. If byteorder is
│ │ │ │ 'little', the most significant byte is at the end
│ │ │ │ of the byte array. To request the native byte order
│ │ │ │ - of the host system, use _s_y_s_._b_y_t_e_o_r_d_e_r as the byte
│ │ │ │ + of the host system, use sys.byteorder as the byte
│ │ │ │ order value.
│ │ │ │ signed
│ │ │ │ Determines whether two's complement is used to
│ │ │ │ - represent the integer. If signed is _F_a_l_s_e and a
│ │ │ │ - negative integer is given, an _O_v_e_r_f_l_o_w_E_r_r_o_r is
│ │ │ │ + represent the integer. If signed is False and a
│ │ │ │ + negative integer is given, an OverflowError is
│ │ │ │ raised.
│ │ │ │ denominator_
│ │ │ │ the denominator of a rational number in lowest terms
│ │ │ │ imag_
│ │ │ │ the imaginary part of a complex number
│ │ │ │ numerator_
│ │ │ │ the numerator of a rational number in lowest terms
│ │ │ │ real_
│ │ │ │ the real part of a complex number
│ │ │ │ ********** mmppzz FFuunnccttiioonnss_? **********
│ │ │ │ gmpy2.bincoef(nn, kk, //) → _m_p_z_
│ │ │ │ Return the binomial coefficient ('n choose k'). k >= 0.
│ │ │ │ gmpy2.bit_clear(xx, nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit cleared.
│ │ │ │ - gmpy2.bit_count(xx, //) → _i_n_t_
│ │ │ │ + gmpy2.bit_count(xx, //) → int_
│ │ │ │ Return the number of 1-bits set in abs(x).
│ │ │ │ gmpy2.bit_flip(xx, nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit inverted.
│ │ │ │ - gmpy2.bit_length(xx, //) → _i_n_t_
│ │ │ │ + gmpy2.bit_length(xx, //) → int_
│ │ │ │ Return the number of significant bits in the radix-2 representation of x.
│ │ │ │ Note: bit_length(0) returns 0.
│ │ │ │ gmpy2.bit_mask(nn, //) → _m_p_z_
│ │ │ │ Return an _m_p_z exactly n bits in length with all bits set.
│ │ │ │ - gmpy2.bit_scan0(xx, nn==00, //) → _i_n_t | _N_o_n_e_
│ │ │ │ + gmpy2.bit_scan0(xx, nn==00, //) → int | None_
│ │ │ │ Return the index of the first 0-bit of x with index >= n. n >= 0. If
│ │ │ │ there are no more 0-bits in x at or above index n (which can only happen
│ │ │ │ - for x<0, assuming an infinitely long 2's complement format), then _N_o_n_e is
│ │ │ │ + for x<0, assuming an infinitely long 2's complement format), then None is
│ │ │ │ returned.
│ │ │ │ - gmpy2.bit_scan1(xx, nn==00, //) → _i_n_t | _N_o_n_e_
│ │ │ │ + gmpy2.bit_scan1(xx, nn==00, //) → int | None_
│ │ │ │ Return the index of the first 1-bit of x with index >= n. n >= 0. If
│ │ │ │ there are no more 1-bits in x at or above index n (which can only happen
│ │ │ │ - for x>=0, assuming an infinitely long 2's complement format), then _N_o_n_e
│ │ │ │ + for x>=0, assuming an infinitely long 2's complement format), then None
│ │ │ │ is returned.
│ │ │ │ gmpy2.bit_set(xx, nn, //) → _m_p_z_
│ │ │ │ Return a copy of x with the n-th bit set.
│ │ │ │ - gmpy2.bit_test(xx, nn, //) → _b_o_o_l_
│ │ │ │ + gmpy2.bit_test(xx, nn, //) → bool_
│ │ │ │ Return the value of the n-th bit of x.
│ │ │ │ gmpy2.c_div(xx, yy, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by y. The quotient is rounded towards
│ │ │ │ +Inf (ceiling rounding). x and y must be integers.
│ │ │ │ gmpy2.c_div_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ Returns the quotient of x divided by 2**n. The quotient is rounded
│ │ │ │ towards +Inf (ceiling rounding). x must be an integer. n must be >0.
│ │ │ │ - gmpy2.c_divmod(xx, yy, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.c_divmod(xx, yy, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the quotient and remainder of x divided by y. The quotient is
│ │ │ │ rounded towards +Inf (ceiling rounding) and the remainder will have the
│ │ │ │ opposite sign of y. x and y must be integers.
│ │ │ │ - gmpy2.c_divmod_2exp(xx, nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.c_divmod_2exp(xx, nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the quotient and remainder of x divided by 2**n. The quotient is
│ │ │ │ rounded towards +Inf (ceiling rounding) and the remainder will be
│ │ │ │ negative. x must be an integer. n must be >0.
│ │ │ │ gmpy2.c_mod(xx, yy, //) → _m_p_z_
│ │ │ │ Return the remainder of x divided by y. The remainder will have the
│ │ │ │ opposite sign of y. x and y must be integers.
│ │ │ │ gmpy2.c_mod_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ @@ -314,166 +314,166 @@
│ │ │ │ gmpy2.comb(nn, kk, //) → _m_p_z_
│ │ │ │ Return the number of combinations of 'n things, taking k at a time'. k >=
│ │ │ │ 0. Same as bincoef(n, k)
│ │ │ │ gmpy2.divexact(xx, yy, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by y. Faster than standard division but
│ │ │ │ requires the remainder is zero!
│ │ │ │ gmpy2.divm(aa, bb, mm, //) → _m_p_z_
│ │ │ │ - Return x such that b*x == a mod m. Raises a _Z_e_r_o_D_i_v_i_s_i_o_n_E_r_r_o_r exception
│ │ │ │ + Return x such that b*x == a mod m. Raises a ZeroDivisionError exception
│ │ │ │ if no such value x exists.
│ │ │ │ gmpy2.double_fac(nn, //) → _m_p_z_
│ │ │ │ Return the exact double factorial (n!!) of n. The double factorial is
│ │ │ │ defined as n*(n-2)*(n-4)...
│ │ │ │ gmpy2.f_div(xx, yy, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by y. The quotient is rounded towards -
│ │ │ │ Inf (floor rounding). x and y must be integers.
│ │ │ │ gmpy2.f_div_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by 2**n. The quotient is rounded towards
│ │ │ │ -Inf (floor rounding). x must be an integer. n must be >0.
│ │ │ │ - gmpy2.f_divmod(xx, yy, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.f_divmod(xx, yy, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the quotient and remainder of x divided by y. The quotient is
│ │ │ │ rounded towards -Inf (floor rounding) and the remainder will have the
│ │ │ │ same sign as y. x and y must be integers.
│ │ │ │ - gmpy2.f_divmod_2exp(xx, nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.f_divmod_2exp(xx, nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return quotient and remainder after dividing x by 2**n. The quotient is
│ │ │ │ rounded towards -Inf (floor rounding) and the remainder will be positive.
│ │ │ │ x must be an integer. n must be >0.
│ │ │ │ gmpy2.f_mod(xx, yy, //) → _m_p_z_
│ │ │ │ Return the remainder of x divided by y. The remainder will have the same
│ │ │ │ sign as y. x and y must be integers.
│ │ │ │ gmpy2.f_mod_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ Return remainder of x divided by 2**n. The remainder will be positive. x
│ │ │ │ must be an integer. n must be >0.
│ │ │ │ gmpy2.fac(nn, //) → _m_p_z_
│ │ │ │ Return the exact factorial of n.
│ │ │ │ See factorial(n) to get the floating-point approximation.
│ │ │ │ gmpy2.fib(nn, //) → _m_p_z_
│ │ │ │ Return the n-th Fibonacci number.
│ │ │ │ - gmpy2.fib2(nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.fib2(nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a 2-tuple with the (n-1)-th and n-th Fibonacci numbers.
│ │ │ │ gmpy2.gcd(**iinntteeggeerrss, //) → _m_p_z_
│ │ │ │ Return the greatest common divisor of integers.
│ │ │ │ - gmpy2.gcdext(aa, bb, //) → _t_u_p_l_e[_m_p_z, _m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.gcdext(aa, bb, //) → tuple[_m_p_z, _m_p_z, _m_p_z]_
│ │ │ │ Return a 3-element tuple (g,s,t) such that g == gcd(a,b) and g == a*s +
│ │ │ │ b*t.
│ │ │ │ - gmpy2.hamdist(xx, yy, //) → _i_n_t_
│ │ │ │ + gmpy2.hamdist(xx, yy, //) → int_
│ │ │ │ Return the Hamming distance (number of bit-positions where the bits
│ │ │ │ differ) between integers x and y.
│ │ │ │ gmpy2.invert(xx, mm, //) → _m_p_z_
│ │ │ │ - Return y such that x*y == 1 modulo m. Raises _Z_e_r_o_D_i_v_i_s_i_o_n_E_r_r_o_r if no
│ │ │ │ + Return y such that x*y == 1 modulo m. Raises ZeroDivisionError if no
│ │ │ │ inverse exists.
│ │ │ │ - gmpy2.iroot(xx, nn, //) → _t_u_p_l_e[_m_p_z, _b_o_o_l]_
│ │ │ │ - Return the integer n-th root of x and boolean value that is _T_r_u_e iff the
│ │ │ │ + gmpy2.iroot(xx, nn, //) → tuple[_m_p_z, bool]_
│ │ │ │ + Return the integer n-th root of x and boolean value that is True iff the
│ │ │ │ root is exact. x >= 0. n > 0.
│ │ │ │ - gmpy2.iroot_rem(xx, nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.iroot_rem(xx, nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a 2-element tuple (y,r), such that y is the integer n-th root of x
│ │ │ │ and x=y**n + r. x >= 0. n > 0.
│ │ │ │ - gmpy2.is_congruent(xx, yy, mm, //) → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is congruent to y modulo m, else return _F_a_l_s_e.
│ │ │ │ - gmpy2.is_divisible(xx, dd, //) → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is divisible by d, else return _F_a_l_s_e.
│ │ │ │ - gmpy2.is_even(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is even, _F_a_l_s_e otherwise.
│ │ │ │ - gmpy2.is_odd(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is odd, _F_a_l_s_e otherwise.
│ │ │ │ - gmpy2.is_power(xx, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is a perfect power (there exists a y and an n > 1, such
│ │ │ │ - that x=y**n), else return _F_a_l_s_e.
│ │ │ │ - gmpy2.is_prime(xx, nn==2255, //) → _b_o_o_l_
│ │ │ │ - Return _T_r_u_e if x is pprroobbaabbllyy prime, else _F_a_l_s_e if x is definitely
│ │ │ │ + gmpy2.is_congruent(xx, yy, mm, //) → bool_
│ │ │ │ + Returns True if x is congruent to y modulo m, else return False.
│ │ │ │ + gmpy2.is_divisible(xx, dd, //) → bool_
│ │ │ │ + Returns True if x is divisible by d, else return False.
│ │ │ │ + gmpy2.is_even(xx, //) → bool_
│ │ │ │ + Return True if x is even, False otherwise.
│ │ │ │ + gmpy2.is_odd(xx, //) → bool_
│ │ │ │ + Return True if x is odd, False otherwise.
│ │ │ │ + gmpy2.is_power(xx, //) → bool_
│ │ │ │ + Return True if x is a perfect power (there exists a y and an n > 1, such
│ │ │ │ + that x=y**n), else return False.
│ │ │ │ + gmpy2.is_prime(xx, nn==2255, //) → bool_
│ │ │ │ + Return True if x is pprroobbaabbllyy prime, else False if x is definitely
│ │ │ │ composite. x is checked for small divisors and up to n Miller-Rabin tests
│ │ │ │ are performed.
│ │ │ │ - gmpy2.is_probab_prime(xx, nn==2255, //) → _i_n_t_
│ │ │ │ + gmpy2.is_probab_prime(xx, nn==2255, //) → int_
│ │ │ │ Return 2 if x is definitely prime, 1 if x is probably prime, or return 0
│ │ │ │ if x is definitely non-prime. x is checked for small divisors and up to n
│ │ │ │ Miller-Rabin tests are performed. Reasonable values of n are between 15
│ │ │ │ and 50.
│ │ │ │ - gmpy2.is_square(xx, //) → _b_o_o_l_
│ │ │ │ - Returns _T_r_u_e if x is a perfect square, else return _F_a_l_s_e.
│ │ │ │ + gmpy2.is_square(xx, //) → bool_
│ │ │ │ + Returns True if x is a perfect square, else return False.
│ │ │ │ gmpy2.isqrt(xx, //) → _m_p_z_
│ │ │ │ Return the integer square root of a non-negative integer x.
│ │ │ │ gmpy2.isqrt_rem(xx, //)_
│ │ │ │ Return a 2-element tuple (s,t) such that s=isqrt(x) and t=x-s*s. x >=0.
│ │ │ │ gmpy2.jacobi(xx, yy, //) → _m_p_z_
│ │ │ │ Return the Jacobi symbol (x|y). y must be odd and >0.
│ │ │ │ gmpy2.kronecker(xx, yy, //) → _m_p_z_
│ │ │ │ Return the Kronecker-Jacobi symbol (x|y).
│ │ │ │ gmpy2.lcm(**iinntteeggeerrss, //) → _m_p_z_
│ │ │ │ Return the lowest common multiple of integers.
│ │ │ │ gmpy2.legendre(xx, yy, //) → _m_p_z_
│ │ │ │ Return the Legendre symbol (x|y). y is assumed to be an odd prime.
│ │ │ │ gmpy2.lucas(nn, //) → _m_p_z_
│ │ │ │ Return the n-th Lucas number.
│ │ │ │ - gmpy2.lucas2(nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.lucas2(nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a 2-tuple with the (n-1)-th and n-th Lucas numbers.
│ │ │ │ gmpy2.mpz_random(rraannddoomm__ssttaattee, iinntt, //) → _m_p_z_
│ │ │ │ Return uniformly distributed random integer between 0 and n-1.
│ │ │ │ gmpy2.mpz_rrandomb(rraannddoomm__ssttaattee, bbiitt__ccoouunntt, //) → _m_p_z_
│ │ │ │ Return a random integer between 0 and 2**bit_count-1 with long sequences
│ │ │ │ of zeros and one in its binary representation.
│ │ │ │ gmpy2.mpz_urandomb(rraannddoomm__ssttaattee, bbiitt__ccoouunntt, //) → _m_p_z_
│ │ │ │ Return uniformly distributed random integer between 0 and 2**bit_count-1.
│ │ │ │ gmpy2.multi_fac(nn, mm, //) → _m_p_z_
│ │ │ │ Return the exact m-multi factorial of n. The m-multifactorial is defined
│ │ │ │ as n*(n-m)*(n-2m)...
│ │ │ │ gmpy2.next_prime(xx, //) → _m_p_z_
│ │ │ │ Return the next pprroobbaabbllee prime number > x.
│ │ │ │ - gmpy2.num_digits(xx, bbaassee==1100, //) → _i_n_t_
│ │ │ │ + gmpy2.num_digits(xx, bbaassee==1100, //) → int_
│ │ │ │ Return length of string representing the absolute value of x in the given
│ │ │ │ base. Values for base can range between 2 and 62. The value returned may
│ │ │ │ be 1 too large.
│ │ │ │ gmpy2.pack(llsstt, nn, //) → _m_p_z_
│ │ │ │ Pack a list of integers lst into a single _m_p_z by concatenating each
│ │ │ │ integer element of lst after padding to length n bits. Raises an error if
│ │ │ │ any integer is negative or greater than n bits in length.
│ │ │ │ - gmpy2.popcount(xx, //) → _i_n_t_
│ │ │ │ + gmpy2.popcount(xx, //) → int_
│ │ │ │ Return the number of 1-bits set in x. If x<0, the number of 1-bits is
│ │ │ │ infinite so -1 is returned in that case.
│ │ │ │ gmpy2.powmod(xx, yy, mm, //) → _m_p_z_
│ │ │ │ Return (x**y) mod m. Same as the three argument version of Python's
│ │ │ │ - built-in _p_o_w, but converts all three arguments to _m_p_z.
│ │ │ │ - gmpy2.powmod_exp_list(bbaassee, eexxpp__llsstt, mmoodd, //) → _l_i_s_t[_m_p_z, ...]_
│ │ │ │ + built-in pow, but converts all three arguments to _m_p_z.
│ │ │ │ + gmpy2.powmod_exp_list(bbaassee, eexxpp__llsstt, mmoodd, //) → list[_m_p_z, ...]_
│ │ │ │ Returns list(powmod(base, i, mod) for i in exp_lst). Will always release
│ │ │ │ the GIL. (Experimental in gmpy2 2.1.x).
│ │ │ │ - gmpy2.powmod_base_list(bbaassee__llsstt, eexxpp, mmoodd, //) → _l_i_s_t[_m_p_z, ...]_
│ │ │ │ + gmpy2.powmod_base_list(bbaassee__llsstt, eexxpp, mmoodd, //) → list[_m_p_z, ...]_
│ │ │ │ Returns list(powmod(i, exp, mod) for i in base_lst). Will always release
│ │ │ │ the GIL. (Experimental in gmpy2 2.1.x).
│ │ │ │ gmpy2.powmod_sec(xx, yy, mm, //) → _m_p_z_
│ │ │ │ Return (x**y) mod m. Calculates x ** y (mod m) but using a constant time
│ │ │ │ algorithm to reduce the risk of side channel attacks. y must be an
│ │ │ │ integer >0. m must be an odd integer.
│ │ │ │ gmpy2.prev_prime(xx, //) → _m_p_z_
│ │ │ │ Return the previous pprroobbaabbllee prime number < x. Only present when compiled
│ │ │ │ with GMP 6.3.0 or later.
│ │ │ │ gmpy2.primorial(nn, //) → _m_p_z_
│ │ │ │ Return the product of all positive prime numbers less than or equal to n.
│ │ │ │ - gmpy2.remove(xx, ff, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.remove(xx, ff, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return a 2-element tuple (y,m) such that x=y*(f**m) and f does not divide
│ │ │ │ y. Remove the factor f from x as many times as possible. m is the
│ │ │ │ multiplicity f in x. f > 1.
│ │ │ │ gmpy2.t_div(xx, yy, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by y. The quotient is rounded towards 0.
│ │ │ │ x and y must be integers.
│ │ │ │ gmpy2.t_div_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ Return the quotient of x divided by 2**n. The quotient is rounded towards
│ │ │ │ zero (truncation). n must be >0.
│ │ │ │ - gmpy2.t_divmod(xx, yy, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.t_divmod(xx, yy, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the quotient and remainder of x divided by y. The quotient is
│ │ │ │ rounded towards zero (truncation) and the remainder will have the same
│ │ │ │ sign as x. x and y must be integers.
│ │ │ │ - gmpy2.t_divmod_2exp(xx, nn, //) → _t_u_p_l_e[_m_p_z, _m_p_z]_
│ │ │ │ + gmpy2.t_divmod_2exp(xx, nn, //) → tuple[_m_p_z, _m_p_z]_
│ │ │ │ Return the quotient and remainder of x divided by 2**n. The quotient is
│ │ │ │ rounded towards zero (truncation) and the remainder will have the same
│ │ │ │ sign as x. x must be an integer. n must be >0.
│ │ │ │ gmpy2.t_mod(xx, yy, //) → _m_p_z_
│ │ │ │ Return the remainder of x divided by y. The remainder will have the same
│ │ │ │ sign as x. x and y must be integers.
│ │ │ │ gmpy2.t_mod_2exp(xx, nn, //) → _m_p_z_
│ │ │ │ Return the remainder of x divided by 2**n. The remainder will have the
│ │ │ │ same sign as x. x must be an integer. n must be >0.
│ │ │ │ - gmpy2.unpack(xx, nn, //) → _l_i_s_t_
│ │ │ │ + gmpy2.unpack(xx, nn, //) → list_
│ │ │ │ Unpack an integer x into a list of n-bit values. Equivalent to repeated
│ │ │ │ division by 2**n. Raises error if x is negative.
│ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t
│ │ │ │ ===============================================================================
│ │ │ │ © Copyright 2024 - 2024, Case Van Horsen.
│ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by _R_e_a_d_ _t_h_e_ _D_o_c_s.
│ │ ├── ./usr/share/doc/python-gmpy2-doc/html/overview.html
│ │ │ @@ -86,15 +86,15 @@
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Overview
│ │ │ The mpz
and mpq
types support arbitrary precision integers and rationals
│ │ │ via the GMP library. These types should be drop-in replacements for Python's
│ │ │ -int
's and Fraction
's, but are significantly faster for large
│ │ │ +int
's and Fraction
's, but are significantly faster for large
│ │ │ values. The cutover point for performance varies, but can be as low as 20 to
│ │ │ 40 digits. All the special integer functions in the GMP are supported.
│ │ │
│ │ │
Warning
│ │ │
gmpy2 can crash the Python interpreter in case of memory allocation
│ │ │ failure. To mitigate this feature of memory management in the GMP library,
│ │ │ you should estimate the size of all results and prevent calculations that
│ │ │ @@ -102,15 +102,15 @@
│ │ │
│ │ │ The mpfr
and mpc
types provide support for correctly rounded multiple
│ │ │ precision real and complex arithmetic via the MPFR and MPC libraries. The
│ │ │ context
type is used to control precision, rounding modes, and exceptional
│ │ │ conditions. For example, division by zero can either return an Infinity or
│ │ │ raise an exception. It is possible to specify different precision and rounding
│ │ │ modes for both the real and imaginary components of an mpc
. The default
│ │ │ -precision is 53 bits --- just same as for Python's float
and complex
types.
│ │ │ +precision is 53 bits --- just same as for Python's float
and complex
types.
│ │ │ Operator overloading is fully supported. Coversion from native Python types is
│ │ │ optimized for performance.
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -18,29 +18,29 @@
│ │ │ │ * _R_e_l_e_a_s_e_ _N_o_t_e_s
│ │ │ │ _g_m_p_y_2
│ │ │ │ * Overview
│ │ │ │ * _V_i_e_w_ _p_a_g_e_ _s_o_u_r_c_e
│ │ │ │ ===============================================================================
│ │ │ │ ************ OOvveerrvviieeww_? ************
│ │ │ │ The _m_p_z and _m_p_q types support arbitrary precision integers and rationals via
│ │ │ │ -the GMP library. These types should be drop-in replacements for Python's _i_n_t's
│ │ │ │ -and _F_r_a_c_t_i_o_n's, but are significantly faster for large values. The cutover
│ │ │ │ +the GMP library. These types should be drop-in replacements for Python's int's
│ │ │ │ +and Fraction's, but are significantly faster for large values. The cutover
│ │ │ │ point for performance varies, but can be as low as 20 to 40 digits. All the
│ │ │ │ special integer functions in the GMP are supported.
│ │ │ │ Warning
│ │ │ │ gmpy2 can crash the Python interpreter in case of memory allocation failure. To
│ │ │ │ mitigate this feature of memory management in the GMP library, you should
│ │ │ │ estimate the size of all results and prevent calculations that can exaust
│ │ │ │ available memory.
│ │ │ │ The _m_p_f_r and _m_p_c types provide support for correctly rounded multiple precision
│ │ │ │ real and complex arithmetic via the MPFR and MPC libraries. The _c_o_n_t_e_x_t type is
│ │ │ │ used to control precision, rounding modes, and exceptional conditions. For
│ │ │ │ example, division by zero can either return an Infinity or raise an exception.
│ │ │ │ It is possible to specify different precision and rounding modes for both the
│ │ │ │ real and imaginary components of an _m_p_c. The default precision is 53 bits --
│ │ │ │ -- just same as for Python's _f_l_o_a_t and _c_o_m_p_l_e_x types.
│ │ │ │ +- just same as for Python's float and complex types.
│ │ │ │ Operator overloading is fully supported. Coversion from native Python types is
│ │ │ │ optimized for performance.
│ │ │ │ _P_r_e_v_i_o_u_s _N_e_x_t
│ │ │ │ ===============================================================================
│ │ │ │ © Copyright 2024 - 2024, Case Van Horsen.
│ │ │ │ Built with _S_p_h_i_n_x using a _t_h_e_m_e provided by _R_e_a_d_ _t_h_e_ _D_o_c_s.
│ │ ├── ./usr/share/doc/python-gmpy2-doc/html/tutorial.html
│ │ │ @@ -177,26 +177,26 @@
│ │ │
gmpy2.DivisionByZeroError:
division by zero
│ │ │
>>> ctx.divzero
│ │ │
True
│ │ │
│ │ │