Skip to main content
Filter by
Sorted by
Tagged with
3 votes
0 answers
138 views

I have recently experienced major crashes on my computer after executing some Python code of mine. My PC would freeze and sometimes show a bluescreen after a few rounds of a seemingly unproblematic ...
Octavius's user avatar
  • 139
1 vote
0 answers
58 views

I am trying to write a Cython function which returns an array of mpz_t (number type of integers from the gmpy2 library). I can successfully define a fixed-size array: cpdef void pows(mpz number): ...
John's user avatar
  • 497
0 votes
0 answers
23 views

Considering this panda data frame : df = pd.DataFrame({'x': list(range(-10000, 10001, 1000))}) I would like to insert a column (named exp_x) that contains the exponential of these numbers. Multi ...
Stef1611's user avatar
  • 2,515
2 votes
0 answers
65 views

I am using gmpy2 to work with high-precision floats (>500 bit of precision). My code contains long lists of such floats, e.g. import gmpy2 gmpy2.get_context().precision = 500 rs = gmpy2....
agg's user avatar
  • 76
0 votes
0 answers
80 views

The conda environment with numpy and gmpy2 packages was created using conda create --name py4mat python=3.9 numpy gmpy2 Created environment was tested using PS C:\_users\rad> conda activate py4mat ...
rad's user avatar
  • 179
1 vote
2 answers
772 views

I am trying to check whether a large integer is a perfect square using gmpy2 in a JIT-decorated (optimized) routine using numba. The example here is for illustrative purposes only (from a theoretical ...
Eldar Sultanow's user avatar
1 vote
3 answers
148 views

I want to know how to check whether a variable is of type mpfr or not, this might sound trivial but a simple isinstance(v, mpfr) can't do the trick. Example: create a variable that is an instance of ...
Ξένη Γήινος's user avatar
0 votes
1 answer
887 views

I am trying to install "gmpy2" on Google Colab via the command: !pip3 install gmpy2 I get the error: Collecting gmpy2 Downloading gmpy2-2.0.8.zip (280 kB) |███████████████████████████...
Dew Debra's user avatar
1 vote
1 answer
148 views

I use pylint and gmpy2 on Kali Linux(WSL2). Pylint makes many complaints about being unable to find gmpy2 members. How can I avoid this? Here is a little example: import gmpy2 print(gmpy2.is_even(6)) ...
FantasqueX's user avatar
0 votes
1 answer
1k views

I am following a tutorial on how to work on multiple-precision arithmetic in Python. In the end I would like to have a numpy array with floats of arbitrary high precision and I need to inverse that ...
maciek's user avatar
  • 2,137
0 votes
1 answer
357 views

While going through a MIT lecture in MITOpencourseware (6.006 lecture 12), I came across the mention of 4 multiplication algorithms (to multiply two n-digit numbers) - Ordinary naive approach with O(...
Anirban Chakraborty's user avatar
1 vote
1 answer
758 views

I have two cdef classes B and C whose methods are exactly the same. The only difference between them is the type of their attributes: one has mpz attributes, the other one int attributes. My first ...
Tristan Nemoz's user avatar
2 votes
1 answer
289 views

Just as the title says I am trying to find a function in the C++ gmp library that does the same thing as the gmpy2 python library's divm(...) function. I can't imagine that gmpy2 has this method and ...
jamlx's user avatar
  • 23
2 votes
1 answer
5k views

I've installed Pyhton 3.7 on Windows10 and when I run pip install gmpy the console return me this error: Collecting gmpy Using cached https://files.pythonhosted.org/packages/26/37/...
Francesco Mantovani's user avatar
1 vote
1 answer
1k views

I'm getting the below error while installing ludwig on colab. Tried a few things but not able to resolve this. ERROR: Command "/usr/bin/python3 -u -c 'import setuptools, tokenize;file='"'"'/tmp/pip-...
Sachin Wagh's user avatar
3 votes
2 answers
112 views

I have a number which is 615 digits in length. Throughout the number, there 8 fixed places where a digit is missing. I have to find what those missing digits are. So there are 10^8 possibilities. ...
trev's user avatar
  • 33
0 votes
1 answer
93 views

I wonder if I don't get something here... Why does qdiv(8,2) return an mpq instead of an mpz? See here: Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "...
cxxl's user avatar
  • 5,420
1 vote
1 answer
838 views

I created the following piece of python code. It should first set the precision of numbers to 10 decimal digits, but printing pi shows 3.156, which only has 3 decimal digits! Would someone please let ...
Olivier's user avatar
  • 665
1 vote
1 answer
191 views

Is it possible to efficiently store big ints in MySQL? Not big as in bigint, more like 1000th Catalan number or so, and there are at least hundreds of them. More likely, thousands. The speed of ...
Synedraacus's user avatar
  • 1,055
0 votes
1 answer
199 views

I want to xor two big integers. Just installed the gmpy2 library, but no mpz_xor operation anywhere. Am I missing something?
framontb's user avatar
  • 2,077
2 votes
1 answer
1k views

I'm trying to compute the natural log of the exponential plus the median of an array but precision of the floating point numbers has to be at 2000 or the answer will always be 0. Here is what I have ...
kethort's user avatar
  • 399
0 votes
1 answer
616 views

After using gmpy2.floor() on an mpz variable: x = mpz(5) x = gmpy2.floor(x/256) x has the type mpfr and not mpz anymore, even though to my understanding, floor always returns integers. How can I ...
netik's user avatar
  • 1,856
0 votes
2 answers
1k views

I want to use gmpy2 with python 2.7 but when I try to import it I get: >>> import gmpy2 Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: ...
R.Mckemey's user avatar
  • 365
2 votes
1 answer
1k views

I understand that floating-point calculation is not accurate due to its nature. I'm trying to find out the best library/way to do multi-precision ration comparison. I'm comparing Fraction, mpq and ...
pythonician_plus_plus's user avatar
0 votes
3 answers
354 views

The Following code examples my problem which does not occur between 10 power 10 and 10 power 11, but does for the example given in code and above it. I can't see where in my code I am not properly ...
ocopa's user avatar
  • 77