gmpy icon indicating copy to clipboard operation
gmpy copied to clipboard

General Multi-Precision arithmetic for Python 2.6+/3+ (GMP, MPIR, MPFR, MPC)

Results 78 gmpy issues
Sort by recently updated
recently updated
newest added

When I run the Sieve of Eratosthenes example code (Python 3.11.5, Win 11 Pro, VS Code editor, RAM-32GB), it fails at around 4.5*10^9. The error message is: "gmp: overflow in...

See https://github.com/python/cpython/pull/116561 and https://github.com/capi-workgroup/decisions/issues/19. I'm not happy with this API and it seems that discussion is ongoing. Maybe it's wise to wait some time...

@skirpichev @oscarbenjamin Some comments on separating GMP, MPFR, and MPC files from gmpy2. This is based on the current code and has only been tested on Windows. Current state has...

```pycon >>> from gmpy2 import * >>> f"{mpfr('123.456'):=.5g}" Traceback (most recent call last): File "", line 1, in ValueError: Invalid conversion specification >>> f"{float(mpfr('123.456')):=.5g}" # works for python floats '123.46'...

Documentation [says](https://gmpy2.readthedocs.io/en/latest/mpfr.html#gmpy2.mpfr.__format__): The default format is '.6f'. While this can be considered as a feature, I would prefer to be compatible with CPython floats here (in short, in CPython default...

The current fallthrough comments only suppress warnings for GCC. `__attribute__((fallthrough));` works for both GCC (>=7) and LLVM. C23 will introduce `[[fallthrough]]`.

E.g.: ```pycon >>> from gmpy2 import digits >>> help(digits) Help on built-in function digits in module gmpy2.gmpy2: digits(...) digits(x, base=10, prec=0, /) -> str Return string representing a number x....

Reproducer: ```pycon >>> from gmpy2 import * >>> format(mpfr(2.675), '.2f') '2.67' >>> get_context().round = RoundUp >>> format(mpfr(2.675), '.2f') '2.67' ``` I'm not sure whether it's a bug or a feature....