FW: Newbie: OverflowError: integer addition - Python data types??

Gene Chiaramonte gchiaramonte at ibl.bm
Thu Feb 3 08:59:28 EST 2000


> try using the long integer type (L) which has no maximum length. python
can
> do it all! <grin>
>
> gene
>
> > -----Original Message-----
> > From: python-list-admin at python.org
> > [mailto:python-list-admin at python.org]On Behalf Of e.e.sutton at cummins.com
> > Sent: Wednesday, February 02, 2000 1:04 PM
> > To: e.e.sutton at cummins.com
> > Subject: Newbie: OverflowError: integer addition - Python data types??
> >
> >
> > I can't get a Python version of my VBScript Fibonacci series script to
> > work.  I get an OverflowError: integer addition error at series 46.
> >
> > Can Python not handle large numbers?
> >
> > Is there a special data type I should be using?
> >
> > Series 45 is the following number.
> > 45	1836311903 (1.84E+09)
> >
> > File "M:\SRC\scripting\fibonacci\fib.py", line 47, in Fibonacci
> >     fib = fibA + fibB
> > OverflowError: integer addition
> >
> > def Fibonacci(i):
> >    fibA=1
> >    fibB=1
> >    if i == 0:
> >       Fibonacci = fibA
> >    elif i == 1:
> >       Fibonacci = fibB
> >    elif i > 1:
> >       fib=0
> >       for j in range(2, i+1):
> >          fib = fibA + fibB
> >          fibA = fibB
> >          fibB = fib
> >       Fibonacci = fib
> >    return Fibonacci
> >
> > Thanks in advance for any tips or suggestions
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
> > --
> > http://www.python.org/mailman/listinfo/python-list
>
>
>





More information about the Python-list mailing list