Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'wed,': 0.04; 'infinite': 0.07; 'python': 0.07; 'recursion': 0.09; 'run.': 0.09; 'tail': 0.09; 'terminate': 0.09; 'pm,': 0.11; 'subject:error': 0.12; 'am,': 0.14; 'wrote:': 0.14; 'agree.': 0.16; 'calculation': 0.16; 'entries.': 0.16; "there'll": 0.16; 'stack': 0.16; 'tue,': 0.20; '(which': 0.21; 'header:In-Reply-To:1': 0.22; 'somehow': 0.23; 'memory': 0.24; 'suspect': 0.25; 'received:209.85.161.46': 0.26; 'received:mail-fx0-f46.google.com': 0.26; 'chris': 0.27; 'skip:b 20': 0.27; 'message-id:@mail.gmail.com': 0.28; 'received:209.85.161': 0.29; 'depends': 0.29; 'probably': 0.30; 'calculate': 0.31; 'complete.': 0.31; 'it.': 0.31; 'meaning': 0.31; 'to:addr:python-list': 0.32; 'source': 0.32; 'filled': 0.33; 'problem,': 0.35; 'difficult': 0.35; 'point': 0.35; '2.6': 0.35; 'safely': 0.35; 'quite': 0.36; 'shows': 0.36; 'received:209.85': 0.37; 'received:google.com': 0.38; 'but': 0.38; 'used': 0.38; 'affect': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.39; 'black': 0.40; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'double': 0.69; 'continued': 0.77; '257': 0.84; 'crunch': 0.84; 'rays': 0.84; 'dark': 0.91; 'holes': 0.91; 'running,': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=xBo9bHiEN+XE8LQUq2AgtyGPvrRIbHo+h/+7JnSAPXE=; b=wCw2sHvVWY3Cjam+14aTVSB9fo5sJ/EGkV/UhLuBkc+q5V5dNAcCbZCJVsgjFJb49P bXvmACTP1V20TcD5eODWr7S+hQ+czLO769RVrA69NLGqx5Wqrwdx4NqhX1IHDb+ZrPIQ t703XBSyS4g6jszcSs1uv5ua+M1rfi34rt1MY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; b=ZG2aWCENtCRLE7EHEuWHuh0c9sLmANcT9ppLC+3NEXWGirXdJP/n8xDnE7Z/Rhjcb3 mM5/N4lEUv30qtX8eFRZgWmAUPVjnIfQrjG33OZYPvl1EkaAaFZUwxjPXPN1FcI/fTp2 mZNk0qDijMeT/Nj0MPiUkSAPK4uT1f7jpiYyw= MIME-Version: 1.0 In-Reply-To: References: <0HFvp.18698$vT3.2042@newsfe06.iad> From: Ian Kelly Date: Tue, 3 May 2011 16:31:29 -0600 Subject: Re: Fibonacci series recursion error To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 21 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304461920 news.xs4all.nl 34849 [::ffff:82.94.164.166]:37836 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4585 On Tue, May 3, 2011 at 3:41 PM, Chris Angelico wrote: > On Wed, May 4, 2011 at 3:10 AM, harrismh777 wrote: >> If your point is that the infinite process is the problem, I agree. But my >> point is that the cpu crunch and the rate at which the call stack is filled >> has to do with the double call (which never finds tail processing). > > The double call _does not_ affect it. Failing to terminate recursion > _does_. I don't know what you mean by "cpu crunch" but the call stack > is going to get n entries. On the Python 2.6 on this system, > sys.getrecursionlimit() returns 1000, meaning that you can calculate > fib(1000) safely (okay, probably not quite as there'll be a few used > for other things, but fib(900) would be safe). Depends what you mean by "safe". A back-of-the-envelope calculation shows that with modern technology it would take more than 10 ** 257 years to complete. That puts it well into the Dark Era of the universe, long after the black holes will have decayed, when I suspect it will be difficult to find a continued power source for the computer to run. And even if it somehow is still running, the process memory will have been so thoroughly muddled by cosmic rays that the final result of the calculation will be utterly worthless.