Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'represents': 0.05; '64-bit': 0.07; '3.0,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'python': 0.11; 'jan': 0.12; 'longs': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'renamed': 0.16; 'subject:skip:m 10': 0.16; 'wrote:': 0.18; 'bit': 0.19; 'fit': 0.20; 'machine': 0.22; '>>>': 0.22; 'header:User-Agent:1': 0.23; '2.x': 0.24; 'removed.': 0.24; 'paul': 0.24; '(or': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'code': 0.31; 'dramatic': 0.31; 'int,': 0.31; 'class': 0.32; 'subject:all': 0.32; 'implemented': 0.33; 'should': 0.36; 'performance': 0.37; 'being': 0.38; 'machines': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; '12,': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'system.': 0.39; 'received:org': 0.40; 'most': 0.60; 'increased': 0.61; 'numbers': 0.61; "you're": 0.61; 'more': 0.64; 'effectively': 0.66; 'believe': 0.68; 'products': 0.71; '2015': 0.84; 'multiplying': 0.84; 'received:fios.verizon.net': 0.84; 'subject:find': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: find all multiplicands and multipliers for a number Date: Sat, 11 Apr 2015 19:58:50 -0400 References: <890bd388-f50a-4dec-9ef5-27715427472a@googlegroups.com> <55288135$0$12997$c3e8da3$5496439d@news.astraweb.com> <87egnrb3il.fsf@jester.gateway.sonic.net> <87619387c0.fsf@elektro.pacujo.net> <87y4lya9eo.fsf@jester.gateway.sonic.net> <87zj6e7erv.fsf@elektro.pacujo.net> <87pp7aa6x0.fsf@jester.gateway.sonic.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-98-114-97-173.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1428796771 news.xs4all.nl 2892 [2001:888:2000:d::a6]:54670 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:88849 On 4/11/2015 5:10 PM, Chris Angelico wrote: > On Sun, Apr 12, 2015 at 3:52 AM, Paul Rubin wrote: >>> PS Note that you're being "wasteful" by multiplying c*c over and over >> >> Yeah this is a reasonable point, though most of the c's should fit in a >> machine word, at least in my 64-bit system. I think Python still >> separates ints and longs in the implementation. > > I don't think it does. In 3.0, the 2.x int class and intobject.c were removed and the long class was renamed int, while longobject.c remained, with code relevant to the int class removed. I believe longobject effectively represents ints in base 2**15 or 2**30 (or 31?) for 32 and 64 bit machines, so that products of 'digits' fit in a single machine word. (I am not sure if the increased size for 64 bit machines was implemented or not.) > Performance doesn't seem to change in Py3 as > the numbers get bigger: I suspect the effect is more dramatic with multiplication. -- Terry Jan Reedy