Comments (9)
Yeah, that's something expected. See e.g. #280: the GMP library can't nicely workaround out of memory condition, it just die with some error messages, which might vary with the GMP version. (Please, next time specify versions of the gmpy2 and used libraries.)
Probably we should at least add a warning in docs.
Not sure if it worth, but as it was noted in the referenced issue: it's possible to implement big integers (only basic arithmetic, of course) on top of low-level GMP API, this will not suffer from this problem.
from gmpy.
(Please, next time specify versions of the gmpy2 and used libraries.)
Recent, of course.
Not sure if it worth, but as it was noted in the referenced issue: it's possible to implement big integers (only basic arithmetic, of course) on top of low-level GMP API, this will not suffer from this problem.
Using only limb functions and structures?
from gmpy.
Using only limb functions and structures?
Yes, sec 8 of the manual - Low-level functions.
from gmpy.
Oh, I forgot. In fact I did docs update, you can see warnings on my fork, which displayed up to date docs: https://gmpy-skirpichev.readthedocs.io/en/latest/overview.html
@DennisYurichev, how this looks?
@casevh, https://gmpy2.readthedocs.io/ again out of sync, this now display pre-2.2.0 docs. Maybe we could really solve #358?
After update, probably this issue should be closed. @casevh, new integer type (based on low-level GMP API) does make sense for you?
from gmpy.
Well, I'm not a gmpy expert, can't say what is the right solution.
from gmpy.
@DennisYurichev, my question was about docs. That's just matter of user experience. Is this a a right place? Will this prevent issues like this or wording in docs is too vague and lacks something?
from gmpy.
Being in shoes of manual's maintainer, I would write something like: "In case of variable overflow, may print 'Floating point error' message, this is a known quirk, to be fixed in future versions".
IMHO!
from gmpy.
Unfortunately, it's not something that could be fixed in the gmpy2 alone. That seems to be a quirk of some OS (M$ Windows, I guess, because message looks totally misleading: e.g. what kind of "Floating point error"?).
On my system I got:
$ sudo swapoff -a
$ ./configure --enable-fat --enable-shared --disable-static --with-pic -q && make -s
[...]
$ gcc a.c -lgmp
$ LD_LIBRARY_PATH=.libs ./a.out
GNU MP: Cannot allocate memory (size=2316966024)
Aborted
$ python3.12 -m venv xxx
$ . xxx/bin/activate
$ pip install gmpy2
[...]
$ python
Python 3.12.0+ (heads/3.12:2162512d71, Jan 13 2024, 11:25:20) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gmpy2 import fac, popcount, mp_version, __version__
>>> __version__
'2.2.1'
>>> mp_version()
'GMP 6.3.0'
>>> popcount(fac(fac(13)))
GNU MP: Cannot allocate memory (size=2316966024)
Aborted
from gmpy.
I haven't access to that huge RAM instance anymore, but I remember I installed gmpy via pip3. But of course, it could be older versions.
from gmpy.
Related Issues (20)
- Issue with large factorial HOT 6
- Access to gmplib.org
- Alternatives to using private API for conversion to/from CPython int's HOT 1
- Build & tests wheels for M$ Windows
- Executing advanced arithmetic operations --C++ to gmpy2 in Python HOT 1
- Is there an alternative for Decimal? HOT 5
- Please make a non-preview release with Python 3.12 support — thank you! HOT 18
- gmpy2 2.2.0a2 missing on PyPI HOT 6
- Windows build comments HOT 2
- Major issue in Linux wheels HOT 1
- Dead paper link in comments
- 2.2.0: change in tagging convention? 🤔 HOT 8
- Abnormal situation of converting "mpz" to "str" HOT 4
- gmpy2 Sieve Example Code Problem HOT 10
- Add .bit_count() to xmpz type
- Type declarations to allow integration with type checking and linting tools HOT 2
- Invalid mpq.__float__?
- Intentional fallthroughs?
- Intentional fallthroughs? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmpy.