Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'folks': 0.04; 'int': 0.05; 'string,': 0.05; 'fine,': 0.07; 'numeric': 0.07; 'python': 0.08; 'arithmetic': 0.09; 'float.': 0.09; "it'd": 0.09; 'precision': 0.09; 'pm,': 0.10; 'result.': 0.14; 'wrote:': 0.14; '(ie': 0.16; 'angelico': 0.16; 'arithmetic,': 0.16; 'bc,': 0.16; 'consecutive': 0.16; 'floats': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'in?': 0.16; 'subject:Fibonacci': 0.16; 'long,': 0.16; 'math': 0.16; 'somewhere': 0.17; 'language': 0.18; 'awesome': 0.19; 'header:In-Reply-To:1': 0.21; 'performing': 0.21; 'integer': 0.23; 'received:209.85.210.174': 0.23; 'received:mail- iy0-f174.google.com': 0.23; 'fri,': 0.23; "what's": 0.23; '(and': 0.25; "i'm": 0.27; 'message-id:@mail.gmail.com': 0.28; '(as': 0.29; 'digit': 0.29; 'implement': 0.30; 'actually.': 0.30; 'decimal': 0.30; 'time)': 0.30; 'usually': 0.32; 'done': 0.32; 'relatively': 0.32; 'someone': 0.33; 'to:addr:python-list': 0.33; 'it?': 0.33; 'things': 0.33; "i've": 0.33; 'chris': 0.34; 'else': 0.35; 'probably': 0.36; 'uses': 0.36; 'too.': 0.37; 'received:google.com': 0.37; 'received:209.85': 0.37; '20,': 0.37; 'floating': 0.37; 'playing': 0.37; 'could': 0.38; 'but': 0.38; 'subject:: ': 0.38; 'some': 0.38; 'should': 0.39; 'received:209': 0.39; 'number,': 0.39; 'to:addr:python.org': 0.39; 'getting': 0.40; 'power': 0.61; 'huge': 0.62; 'love': 0.62; 'straight': 0.63; 'bring': 0.64; 'taking': 0.64; 'specialized': 0.69; 'hand,': 0.74; 'promote': 0.78; 'alone.': 0.91; 'absolutely': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=9FhpWs0fCxYfyx4y46cHEKJrEfLZg9kaYSDc57+3OXg=; b=WFt41oi/wLdKojoSfX6XODzlS+PQnoNe6NQxinTr5ZIaR3IV8mARExIfRk7FNogvXM 7uhpTx/CAtR8rrlE3jVwPtACBsa51YgqWZCFtQmPrmbO1OzYolrqiDjhfRjW7RBZh0ck C5LUhSop2gXMC99lrxVZrtnyP3Cd6rLCV1PSM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=C53y8irG6WFaV16L8zjDW5IpcyCT940EkNAvwy/MeTGhGSEagP5BjnUdJTuEDdGw0Z ji7uNZTuzoZFw3PtXiP77yO42K8bcyjsCVjqOIpFFeEN2q7P1PtanvlVdGrzLyQOD//W GIaAO3NH06k1MyjorifU7Bs4LqpS/59lRIZNc= MIME-Version: 1.0 In-Reply-To: References: <108ce447-10fa-4cf7-84ef-440ee18dbfd4@22g2000prx.googlegroups.com> <9d9c163b-14fd-4131-81bb-105c3b97c432@h36g2000pro.googlegroups.com> <4dd59e1e$0$29996$c3e8da3$5496439d@news.astraweb.com> <4dd602ec$0$29996$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 20 May 2011 16:54:06 +1000 Subject: Re: Faster Recursive Fibonacci Numbers From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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: 39 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1305874452 news.xs4all.nl 49045 [::ffff:82.94.164.166]:45011 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:5825 On Fri, May 20, 2011 at 4:26 PM, harrismh777 wrot= e: > Actually, it should be relatively easy to incorporate parts of bc into > Python as C extensions. On the other hand, when needing specialized math > work from bc, its probably just better to use bc and leave Python alone. If someone has time to kill (as if!), it'd be awesome to get a new numeric type that uses bc's code; any other numeric type (int, long, float) could autopromote to it, removing the dilemma of which to promote out of long and float. Hmm... Python 4.0, 'bc' is the new default integer and everything else is a performance optimization? Heh. > On the other hand, most of the time (and I mean 99.999% of the time) floa= ts > are going to work just fine... usually folks don't even need doubles.... > :) 99.9% of the time int will work fine, too. Most people don't need arbitrary precision OR floating point. > Don't get me wrong... I absolutely love playing around with bignums, but > then, I'm a math geek... =A0 =A0;-) Absolutely. Bring on the geekiness. I've used bignums for things other than straight arithmetic, actually. In REXX, where everything is a string, I've done some fascinating (and completely useless) analyses that involve taking internal digits from a number, performing arithmetic on them, getting huge numbers back, and then searching for substrings (ie digit strings) in the result. What's the lowest power of 2 that has 5 consecutive digits in it? All 10 digits? (That is, it has '0123456789' somewhere in its decimal representation.) Like I said, completely useless... but how many of you immediately pondered which language to implement the search in? Chris Angelico