where the function has problem? n = 900 is OK , but n = 1000 is ERROR

Steven D'Aprano steve+comp.lang.python at pearwood.info
Mon Aug 1 18:06:53 EDT 2011


Billy Mays wrote:

> I have fixed the problem for you:
> 
> 
> def fibo(n):
>      phi = (1+5**.5)/2; iphi = 1-phi;
>      return (phi**n - iphi**n) / (5**.5)


Does your definition of "fixed" mean "gives wrong results for n >= 4 "?

>>> fibo(4) == 3
False



-- 
Steven




More information about the Python-list mailing list