pypi / gmpy2
gmpy2
What changed in gmpy2 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-19.
4 breaking9 new APIs and options2 performance2 behavior and defaults13 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initgmpy2 230 changes
Breaking changes 4
Drops support for CPython 3.8.
Sets the default precision to 6 for e/E format types.
Formatting now uses the context's rounding mode by default.
Adjusts to_bytes() behavior to match CPython.
New APIs and options 9
Adds alternate-form support in floating-point formatting.
Division functions now receive context arguments.
Adds mixed-mode arithmetic support for mpc.
Adds support for '%' formatting of mpfr values.
Adds an is_integer() method for mpq values.
Adds limit_denominator() to mpq.
Adds support for floating-point formatting types for mpz values.
Adds an
mpz.__array__()method to interact with NumPy.Adds an is_integer() method for mpz values.
Performance 2
Optimizes the to_binary() function.
Optimizes the to_bytes() method.
Behavior and default changes 2
Constraints related to Jacobi were relaxed.
Adds support for free-threading builds.
Fixes and other changes 13
An IEEE-related fix was merged.
Converting an infinite mpfr value to float is supported instead of raising OverflowError.
Fixes a memory leak when exiting a context.
Fixes mixed-mode complex division when the left operand is real.
Fixes creating mpfr values from negative values with base=0.
Fixes conversion of mpq values to float.
Fixes conversion of mpz values to float.
Corrects the optimization used when rounding mpz values with negative ndigits.
Avoids OverflowError in mpz right-shift operations.
String output ignores the sign bit of NaNs, matching CPython.
Adds support for PyPy.
Rounding methods use the context's rounding mode.
Adds missing exceptions for true division.