Max Long

T

tjhnson

How can I figure out the largest long available? I was hoping for
something like sys.maxint, but I didn't see it. Also, can someone
point me to where I can (concisely) read about size of such types
(int, float, long).
 
G

Gary Herron

How can I figure out the largest long available? I was hoping for
something like sys.maxint, but I didn't see it. Also, can someone
point me to where I can (concisely) read about size of such types
(int, float, long).
There is no explicit (defined) limit. The amount of available address
space forms a practical limit.

Gary Herron
 
M

mensanator

There is no explicit (defined) limit.  The amount of available address
space forms a practical limit.

But not the only limitation:
a = cf.Type12MH(k,1)
print 'number of digits in generation %2d:' %
(k),cf.gmpy.numdigits(a)

number of digits in generation 1: 2
number of digits in generation 2: 9
number of digits in generation 3: 74
number of digits in generation 4: 659
number of digits in generation 5: 5926
number of digits in generation 6: 53328
number of digits in generation 7: 479940
number of digits in generation 8: 4319453
number of digits in generation 9: 38875064
number of digits in generation 10: 349875565

Traceback (most recent call last):
File "<pyshell#12>", line 2, in <module>
a = cf.Type12MH(k,1)
File "C:\Program Files\PyGTK\Python\lib\collatz_functions.py", line
745, in Type12MH
return TWO**(SIX*a - ONE) - ONE
ValueError: mpz.pow outrageous exponent

The power function can't do exponents that have 32 or more bits
even if the memory can hold the resulting number.
 
G

Gabriel Genellina

En Mon, 21 Jan 2008 22:02:34 -0200, (e-mail address removed)
(e-mail address removed) wrote:

There is no explicit (defined) limit.  The amount of available address
space forms a practical limit.

But not the only limitation:
[...]
Traceback (most recent call last):
File "<pyshell#12>", line 2, in <module>
a = cf.Type12MH(k,1)
File "C:\Program Files\PyGTK\Python\lib\collatz_functions.py", line
745, in Type12MH
return TWO**(SIX*a - ONE) - ONE
ValueError: mpz.pow outrageous exponent

The power function can't do exponents that have 32 or more bits
even if the memory can hold the resulting number.

Isn't it a limitation of the gmpy library, not of the builtin long type?
 
M

mensanator

En Mon, 21 Jan 2008 22:02:34 -0200, (e-mail address removed)  
<[email protected]> escribió:




But not the only limitation:
[...]
Traceback (most recent call last):
  File "<pyshell#12>", line 2, in <module>
    a = cf.Type12MH(k,1)
  File "C:\Program Files\PyGTK\Python\lib\collatz_functions.py", line
745, in Type12MH
    return TWO**(SIX*a - ONE) - ONE
ValueError: mpz.pow outrageous exponent
The power function can't do exponents that have 32 or more bits
even if the memory can hold the resulting number.

Isn't it a limitation of the gmpy library, not of the builtin long type?

Well, gmpy for sure. But as for Python's builtin
longs, I wouldn't know as I've only got one lifetime.

Python longs

c:\python25\user>long_ago.py
1 2 0.0310001373291
2 9 0.0310001373291
3 74 0.0310001373291
4 659 0.0620000362396
5 5926 0.0620000362396
6 53328 0.219000101089
7 479940 63.5620000362
8 4319453 8983.07800007
9 <aborted after 8 hours - at this rate,
it will take 796 years to finish generation 11>

GMPY longs

c:\python25\user>long_ago.py
1 2 0.0
2 9 0.0160000324249
3 74 0.0160000324249
4 659 0.0160000324249
5 5926 0.0160000324249
6 53328 0.0160000324249
7 479940 0.0160000324249
8 4319453 0.0320000648499
9 38875064 0.15700006485
10 349875565 1.36000013351
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top