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

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Aug 2 00:06:53 CEST 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