New to Py 3.3.3 having prob. with large integer div. float.

hlauk.h.bogart at gmail.com hlauk.h.bogart at gmail.com
Tue Feb 11 03:40:03 CET 2014


I am coming off Python 2.6.6 32 bite platform and now in win 8.1 64 bite.
I had no problems with gmpy in 2.6.6 and large integer floating points where
you could control the length of the floating point by entering the bite size
of the divisor(s) you are using. That would give the limit length of the float
in the correct number of bites.

In Python 3.3.3 and gmpy2 I have tried many things in the import mpfr module
changing and trying all kinds of parameters in the gmpy2 set_context module 
and others.

The best I can get without an error is the results of a large integer 
division is a/b = inf. or an integer rounded up or down.
I can't seem to find the right settings for the limit of the remainders in the
quotient.  

My old code in the first few lines of 2.6.6 worked great and looked like this -

import gmpy

BIG =(A large composite with 2048 bites) 
SML =(a smaller divisor with 1024 bites)

Y= gmpy.mpz(1)
A= gmpy.mpf(1)

y=Y
x=BIG
z=SML
a=A
k=BIG
j=BIG
x=+ gmpy.next.prime(x)

while y < 20: 
    B = gmpy.mpf(x.1024)
## the above set the limit of z/b float (see below) to 1024   
    b=B
    a=z/b
    c=int(a)
    d=a-c
    if d = <.00000000000000000000000000000000001:
         proc. continues from here with desired results.

gmpy2 seems a lot more complex but I am sure there is a work around.
I am not interested in the mod function.

My new conversion proc. is full of ## tags on the different things
I tried that didn't work.

TIA 

Dan



More information about the Python-list mailing list