Re: Max Long

2008-01-23 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:

> Indeed, as the docs pointed out.  I guess I was confused by
> 
> "If pylong is greater than ULONG_MAX, an OverflowError is raised."
> 
> at http://docs.python.org/api/longObjects.html.

Take care -- this is about "unsigned long" data type of C, not a
Python "long" instance.

Regards,


Björn

-- 
BOFH excuse #75:

There isn't any problem

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-22 Thread [EMAIL PROTECTED]
On Jan 21, 7:42 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
> En Mon, 21 Jan 2008 22:02:34 -0200, [EMAIL PROTECTED]  
> <[EMAIL PROTECTED]> escribió:
>
>
>
>
>
> > On Jan 21, 5:36 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> >> [EMAIL PROTECTED] wrote:
> >> > How can I figure out the largest long available?  I was hoping for
>
> >> 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 "", line 2, in 
> >     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   20.0310001373291
2   90.0310001373291
3  740.0310001373291
4 6590.062362396
559260.062362396
6   533280.219000101089
7  479940   63.562362
8 4319453 8983.0787
9 

GMPY longs

c:\python25\user>long_ago.py
1  2 0.0
2  9 0.016324249
3 74 0.016324249
4659 0.016324249
5   5926 0.016324249
6  53328 0.016324249
7 479940 0.016324249
84319453 0.032648499
9   38875064 0.1576485
10 349875565 1.3613351


>
> --
> Gabriel Genellina- Hide quoted text -
>
> - Show quoted text -

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-21 Thread Gabriel Genellina
En Mon, 21 Jan 2008 22:02:34 -0200, [EMAIL PROTECTED]  
<[EMAIL PROTECTED]> escribió:

> On Jan 21, 5:36 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
>> [EMAIL PROTECTED] wrote:

>> > How can I figure out the largest long available?  I was hoping for
>>
>> 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 "", line 2, in 
> 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?

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-21 Thread tjhnson
On Jan 21, 3:34 pm, Bjoern Schliessmann  wrote:
> [EMAIL PROTECTED] wrote:
> > How can I figure out the largest long available?
>
> Why would you? AFAIK, longs are only limited by available memory.

Indeed, as the docs pointed out.  I guess I was confused by

"If pylong is greater than ULONG_MAX, an OverflowError is raised."

at http://docs.python.org/api/longObjects.html.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-21 Thread [EMAIL PROTECTED]
On Jan 21, 5:36 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > 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.

But not the only limitation:

>>> import collatz_functions as cf
>>> for k in xrange(1,20):
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 "", line 2, in 
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.

>
> Gary Herron

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-21 Thread Gary Herron
[EMAIL PROTECTED] wrote:
> 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

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max Long

2008-01-21 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote:
> How can I figure out the largest long available?

Why would you? AFAIK, longs are only limited by available memory.

> 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).

Well, how about the docs?

http://docs.python.org/lib/typesnumeric.html

Regards,


Björn

-- 
BOFH excuse #397:

T-1's congested due to porn traffic to the news server.

-- 
http://mail.python.org/mailman/listinfo/python-list


Max Long

2008-01-21 Thread 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).
-- 
http://mail.python.org/mailman/listinfo/python-list